Advertisement
Guest User

Untitled

a guest
Aug 28th, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. for (final Template.BlockInfo aBlockList : blockList)
  2. {
  3. Block block = aBlockList.blockState.getBlock();
  4. IBlockState iblockstate = aBlockList.blockState;
  5.  
  6. if (block == ModBlocks.blockSubstitution)
  7. {
  8. continue;
  9. }
  10.  
  11. if (block == ModBlocks.blockSolidSubstitution)
  12. {
  13. iblockstate = BlockUtils.getSubstitutionBlockAtWorld(clientWorld, startingPos);
  14. block = iblockstate.getBlock();
  15. }
  16.  
  17. final BlockPos blockpos = aBlockList.pos.add(startingPos);
  18. final IBlockState iBlockExtendedState = block.getExtendedState(iblockstate, clientWorld, blockpos);
  19. final IBakedModel ibakedmodel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(iblockstate);
  20. TileEntity tileentity = null;
  21. if (block.hasTileEntity(iblockstate) && aBlockList.tileentityData != null)
  22. {
  23. tileentity = block.createTileEntity(clientWorld, iblockstate);
  24. tileentity.readFromNBT(aBlockList.tileentityData);
  25. }
  26. final ModelHolder models = new ModelHolder(blockpos, iblockstate, iBlockExtendedState, tileentity, ibakedmodel);
  27. getQuads(models, models.quads);
  28. this.renderGhost(clientWorld, models, player, partialTicks);
  29. }
  30.  
  31.  
  32. public void renderGhost(final World world, final ModelHolder holder, final EntityPlayer player, final float partialTicks)
  33. {
  34. final boolean existingModel = !this.mc.world.isAirBlock(holder.pos);
  35.  
  36. final IBlockState actualState = holder.actualState;
  37. final Block block = actualState.getBlock();
  38.  
  39. if (actualState.getRenderType() == EnumBlockRenderType.MODEL)
  40. {
  41. final BlockRenderLayer originalLayer = MinecraftForgeClient.getRenderLayer();
  42.  
  43. for (final BlockRenderLayer layer : BlockRenderLayer.values())
  44. {
  45. if (block.canRenderInLayer(actualState, layer))
  46. {
  47. this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
  48. ForgeHooksClient.setRenderLayer(layer);
  49. this.renderGhostBlock(world, holder, player, layer, existingModel, partialTicks);
  50. holder.setRendered(true);
  51. }
  52. }
  53.  
  54. ForgeHooksClient.setRenderLayer(originalLayer);
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement