From 673ccb6b42faf4c45871ba4ce2e23d3ff1936320 Mon Sep 17 00:00:00 2001 From: Flow86 Date: Thu, 28 Mar 2013 12:08:53 +0100 Subject: [PATCH] fix render refinery --- .../factory/render/RenderRefinery.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/common/buildcraft/factory/render/RenderRefinery.java b/common/buildcraft/factory/render/RenderRefinery.java index bef16b51..1c4b8b6f 100644 --- a/common/buildcraft/factory/render/RenderRefinery.java +++ b/common/buildcraft/factory/render/RenderRefinery.java @@ -12,6 +12,7 @@ package buildcraft.factory.render; import java.util.HashMap; import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.GLAllocation; @@ -33,10 +34,10 @@ public class RenderRefinery extends TileEntitySpecialRenderer implements IInvent static final float factor = (float) (1.0 / 16.0); - private ModelRenderer tank; - private ModelRenderer magnet[] = new ModelRenderer[4]; + private final ModelRenderer tank; + private final ModelRenderer magnet[] = new ModelRenderer[4]; - private ModelBase model = new ModelBase() { + private final ModelBase model = new ModelBase() { }; public RenderRefinery() { @@ -64,7 +65,7 @@ public class RenderRefinery extends TileEntitySpecialRenderer implements IInvent final static private int displayStages = 100; - private HashMap> stage = new HashMap>(); + private final HashMap> stage = new HashMap>(); private int[] getDisplayLists(int liquidId, int damage, World world) { @@ -81,10 +82,14 @@ public class RenderRefinery extends TileEntitySpecialRenderer implements IInvent BlockInterface block = new BlockInterface(); + String spriteSet = "/gui/items.png"; + // Retrieve the texture depending on type of item. if (liquidId < Block.blocksList.length && Block.blocksList[liquidId] != null) { - block.texture = Block.blocksList[liquidId].getBlockTextureFromSideAndMetadata(0, damage); + block.baseBlock = Block.blocksList[liquidId]; + spriteSet = "/terrain.png"; } else if (Item.itemsList[liquidId] != null) { + block.baseBlock = Block.waterStill; block.texture = Item.itemsList[liquidId].getIconFromDamage(damage); } else return null; @@ -93,6 +98,8 @@ public class RenderRefinery extends TileEntitySpecialRenderer implements IInvent d[s] = GLAllocation.generateDisplayLists(1); GL11.glNewList(d[s], 4864 /* GL_COMPILE */); + Minecraft.getMinecraft().renderEngine.bindTexture(spriteSet); + block.minX = 0.5 - 4F * factor + 0.01; block.minY = 0; block.minZ = 0.5 - 4F * factor + 0.01; @@ -224,14 +231,11 @@ public class RenderRefinery extends TileEntitySpecialRenderer implements IInvent theMagnet.render(factor); GL11.glTranslatef(0, -trans2, -12F * factor); - GL11.glTranslatef(0.5F, 0.5F, 0.5F); - GL11.glTranslatef(-4F * factor, 0, -4F * factor); if (qty1 > 0) { int[] list1 = getDisplayLists(liquid1, liquidMeta1, tile.worldObj); if (list1 != null) { - setTextureFor(liquid1); GL11.glCallList(list1[(int) ((float) qty1 / (float) TileRefinery.LIQUID_PER_SLOT * (displayStages - 1))]); } } @@ -242,7 +246,6 @@ public class RenderRefinery extends TileEntitySpecialRenderer implements IInvent int[] list2 = getDisplayLists(liquid2, liquidMeta2, tile.worldObj); if (list2 != null) { - setTextureFor(liquid2); GL11.glCallList(list2[(int) ((float) qty2 / (float) TileRefinery.LIQUID_PER_SLOT * (displayStages - 1))]); } } @@ -253,7 +256,6 @@ public class RenderRefinery extends TileEntitySpecialRenderer implements IInvent int[] list3 = getDisplayLists(liquid3, liquidMeta3, tile.worldObj); if (list3 != null) { - setTextureFor(liquid3); GL11.glCallList(list3[(int) ((float) qty3 / (float) TileRefinery.LIQUID_PER_SLOT * (displayStages - 1))]); } } @@ -262,7 +264,4 @@ public class RenderRefinery extends TileEntitySpecialRenderer implements IInvent GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); } - - public void setTextureFor(int liquidId) { - } }