use of com.minecolonies.structures.fake.FakeEntity in project minecolonies by Minecolonies.
the class Structure method renderGhost.
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);
}
if (holder.te != null && !holder.isRendered()) {
final TileEntity te = holder.te;
te.setPos(holder.pos);
final FakeWorld fakeWorld = new FakeWorld(holder.actualState, world.getSaveHandler(), world.getWorldInfo(), world.provider, world.theProfiler, true);
te.setWorld(fakeWorld);
final int pass = 0;
if (te.shouldRenderInPass(pass)) {
final TileEntityRendererDispatcher terd = TileEntityRendererDispatcher.instance;
terd.prepare(fakeWorld, Minecraft.getMinecraft().renderEngine, Minecraft.getMinecraft().fontRendererObj, new FakeEntity(fakeWorld), null, 0.0F);
GL11.glPushMatrix();
terd.renderEngine = Minecraft.getMinecraft().renderEngine;
terd.preDrawBatch();
GL11.glColor4f(1F, 1F, 1F, 1F);
terd.renderTileEntity(te, partialTicks, -1);
terd.drawBatch(pass);
GL11.glPopMatrix();
}
}
}
Aggregations