Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (final Template.BlockInfo aBlockList : blockList)
- {
- Block block = aBlockList.blockState.getBlock();
- IBlockState iblockstate = aBlockList.blockState;
- if (block == ModBlocks.blockSubstitution)
- {
- continue;
- }
- if (block == ModBlocks.blockSolidSubstitution)
- {
- iblockstate = BlockUtils.getSubstitutionBlockAtWorld(clientWorld, startingPos);
- block = iblockstate.getBlock();
- }
- final BlockPos blockpos = aBlockList.pos.add(startingPos);
- final IBlockState iBlockExtendedState = block.getExtendedState(iblockstate, clientWorld, blockpos);
- final IBakedModel ibakedmodel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(iblockstate);
- TileEntity tileentity = null;
- if (block.hasTileEntity(iblockstate) && aBlockList.tileentityData != null)
- {
- tileentity = block.createTileEntity(clientWorld, iblockstate);
- tileentity.readFromNBT(aBlockList.tileentityData);
- }
- final ModelHolder models = new ModelHolder(blockpos, iblockstate, iBlockExtendedState, tileentity, ibakedmodel);
- getQuads(models, models.quads);
- this.renderGhost(clientWorld, models, player, partialTicks);
- }
- public void renderGhost(final World world, final ModelHolder holder, final EntityPlayer player, final float partialTicks)
- {
- final boolean existingModel = !this.mc.world.isAirBlock(holder.pos);
- final IBlockState actualState = holder.actualState;
- final Block block = actualState.getBlock();
- if (actualState.getRenderType() == EnumBlockRenderType.MODEL)
- {
- final BlockRenderLayer originalLayer = MinecraftForgeClient.getRenderLayer();
- for (final BlockRenderLayer layer : BlockRenderLayer.values())
- {
- if (block.canRenderInLayer(actualState, layer))
- {
- this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
- ForgeHooksClient.setRenderLayer(layer);
- this.renderGhostBlock(world, holder, player, layer, existingModel, partialTicks);
- holder.setRendered(true);
- }
- }
- ForgeHooksClient.setRenderLayer(originalLayer);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement