Various efficiency improvements to pipe rendering.

This commit is contained in:
CovertJaguar 2012-07-19 19:33:49 -07:00
parent 47eff20cb5
commit ecf58dc38f

View file

@ -227,14 +227,15 @@ public class RenderPipe extends TileEntitySpecialRenderer {
if (pipe.pipe == null)
return;
if (pipe.pipe.transport instanceof PipeTransportLiquids)
renderLiquids(pipe.pipe, x, y, z);
if (pipe.pipe.transport instanceof PipeTransportItems)
if (pipe.pipe.transport instanceof PipeTransportItems)
renderSolids(pipe.pipe, x, y, z);
if (pipe.pipe.transport instanceof PipeTransportPower)
else if (pipe.pipe.transport instanceof PipeTransportLiquids)
renderLiquids(pipe.pipe, x, y, z);
else if (pipe.pipe.transport instanceof PipeTransportPower)
renderPower(pipe.pipe, x, y, z);
}
private void renderPower(Pipe pipe, double x, double y, double z) {
@ -355,11 +356,10 @@ public class RenderPipe extends TileEntitySpecialRenderer {
o = Block.blocksList[liquidId];
else
o = Item.itemsList[liquidId];
if (o instanceof ITextureProvider)
MinecraftForgeClient.bindTexture(((ITextureProvider) o).getTextureFile());
else
MinecraftForgeClient.bindTexture("/terrain.png");
// should be safe, items and block all implement ITextureProvider now
// and if o is null, something else is wrong somewhere
MinecraftForgeClient.bindTexture(((ITextureProvider) o).getTextureFile());
return getDisplayLiquidLists(liquidId, world);
}
@ -367,10 +367,12 @@ public class RenderPipe extends TileEntitySpecialRenderer {
private void renderSolids(Pipe pipe, double x, double y, double z) {
GL11.glPushMatrix();
GL11.glDisable(2896 /* GL_LIGHTING */);
float light = pipe.worldObj.getLightBrightness(pipe.xCoord, pipe.yCoord, pipe.zCoord);
for (EntityData data : ((PipeTransportItems) pipe.transport).travelingEntities.values())
doRenderItem(data.item, x + data.item.posX - pipe.xCoord, y + data.item.posY - pipe.yCoord, z + data.item.posZ
- pipe.zCoord, pipe.worldObj.getLightBrightness(pipe.xCoord, pipe.yCoord, pipe.zCoord));
- pipe.zCoord, light);
GL11.glEnable(2896 /* GL_LIGHTING */);
GL11.glPopMatrix();
@ -391,10 +393,6 @@ public class RenderPipe extends TileEntitySpecialRenderer {
byte quantity = 1;
if (entityitem.item.stackSize > 1)
quantity = 2;
if (entityitem.item.stackSize > 5)
quantity = 3;
if (entityitem.item.stackSize > 20)
quantity = 4;
GL11.glTranslatef((float) d, (float) d1, (float) d2);
GL11.glEnable(32826 /* GL_RESCALE_NORMAL_EXT */);