diff --git a/common/buildcraft/core/gui/GuiAdvancedInterface.java b/common/buildcraft/core/gui/GuiAdvancedInterface.java index 171f4985..d9108443 100644 --- a/common/buildcraft/core/gui/GuiAdvancedInterface.java +++ b/common/buildcraft/core/gui/GuiAdvancedInterface.java @@ -185,9 +185,9 @@ public abstract class GuiAdvancedInterface extends GuiBuildCraft { @Override public void drawSprite(int cornerX, int cornerY) { - if(fluid != null) - FluidRenderer.colorFluid(new FluidStack(fluid,100)); // Lacks FluidStack to properly function Please revise. - super.drawSprite(cornerX, cornerY); + if (fluid != null) + FluidRenderer.setColorForFluidStack(new FluidStack(fluid, 100)); + super.drawSprite(cornerX, cornerY); } @Override diff --git a/common/buildcraft/core/render/FluidRenderer.java b/common/buildcraft/core/render/FluidRenderer.java index 0fc65143..eaa3f1b9 100644 --- a/common/buildcraft/core/render/FluidRenderer.java +++ b/common/buildcraft/core/render/FluidRenderer.java @@ -17,7 +17,6 @@ import net.minecraft.util.Icon; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import org.lwjgl.opengl.GL11; @@ -75,14 +74,16 @@ public class FluidRenderer { public static ResourceLocation getFluidSheet(Fluid liquid) { return BLOCK_TEXTURE; } - - public static void colorFluid(FluidStack fluidstack){ - if(fluidstack== null) return; - int color = fluidstack.getFluid().getColor(fluidstack); - float red = (float) (color >> 16 & 255) / 255.0F; - float green = (float) (color >> 8 & 255) / 255.0F; - float blue = (float) (color & 255) / 255.0F; - GL11.glColor4f(red, green, blue, 1); + + public static void setColorForFluidStack(FluidStack fluidstack) { + if (fluidstack == null) + return; + + int color = fluidstack.getFluid().getColor(fluidstack); + float red = (float) (color >> 16 & 255) / 255.0F; + float green = (float) (color >> 8 & 255) / 255.0F; + float blue = (float) (color & 255) / 255.0F; + GL11.glColor4f(red, green, blue, 1); } public static int[] getFluidDisplayLists(FluidStack fluidStack, World world, boolean flowing) { @@ -114,11 +115,7 @@ public class FluidRenderer { GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_CULL_FACE); - int color = fluid.getColor(fluidStack); - float c1 = (float) (color >> 16 & 255) / 255.0F; - float c2 = (float) (color >> 8 & 255) / 255.0F; - float c3 = (float) (color & 255) / 255.0F; - GL11.glColor4f(c1, c2, c3, 1); + for (int s = 0; s < DISPLAY_STAGES; ++s) { diplayLists[s] = GLAllocation.generateDisplayLists(1); GL11.glNewList(diplayLists[s], 4864 /*GL_COMPILE*/); diff --git a/common/buildcraft/factory/render/RenderRefinery.java b/common/buildcraft/factory/render/RenderRefinery.java index f466974a..0070669c 100644 --- a/common/buildcraft/factory/render/RenderRefinery.java +++ b/common/buildcraft/factory/render/RenderRefinery.java @@ -182,7 +182,7 @@ public class RenderRefinery extends TileEntitySpecialRenderer implements IInvent if (list1 != null) { func_110628_a(FluidRenderer.getFluidSheet(liquid1)); - FluidRenderer.colorFluid(liquid1); + FluidRenderer.setColorForFluidStack(liquid1); GL11.glCallList(list1[(int) ((float) liquid1.amount / (float) TileRefinery.LIQUID_PER_SLOT * (FluidRenderer.DISPLAY_STAGES - 1))]); } } @@ -194,7 +194,7 @@ public class RenderRefinery extends TileEntitySpecialRenderer implements IInvent GL11.glPushMatrix(); GL11.glTranslatef(0, 0, 1); func_110628_a(FluidRenderer.getFluidSheet(liquid2)); - FluidRenderer.colorFluid(liquid2); + FluidRenderer.setColorForFluidStack(liquid2); GL11.glCallList(list2[(int) ((float) liquid2.amount / (float) TileRefinery.LIQUID_PER_SLOT * (FluidRenderer.DISPLAY_STAGES - 1))]); GL11.glPopMatrix(); } @@ -208,7 +208,7 @@ public class RenderRefinery extends TileEntitySpecialRenderer implements IInvent GL11.glPushMatrix(); GL11.glTranslatef(1, 0, 0.5F); func_110628_a(FluidRenderer.getFluidSheet(liquidResult)); - FluidRenderer.colorFluid(liquidResult); + FluidRenderer.setColorForFluidStack(liquidResult); GL11.glCallList(list3[(int) ((float) liquidResult.amount / (float) TileRefinery.LIQUID_PER_SLOT * (FluidRenderer.DISPLAY_STAGES - 1))]); GL11.glPopMatrix(); } diff --git a/common/buildcraft/factory/render/RenderTank.java b/common/buildcraft/factory/render/RenderTank.java index 73729872..579c961a 100644 --- a/common/buildcraft/factory/render/RenderTank.java +++ b/common/buildcraft/factory/render/RenderTank.java @@ -39,7 +39,7 @@ public class RenderTank extends TileEntitySpecialRenderer { GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); func_110628_a(FluidRenderer.getFluidSheet(liquid)); - FluidRenderer.colorFluid(liquid); + FluidRenderer.setColorForFluidStack(liquid); GL11.glTranslatef((float) x + 0.125F, (float) y, (float) z + 0.125F); GL11.glScalef(0.75F, 0.999F, 0.75F); diff --git a/common/buildcraft/transport/render/RenderPipe.java b/common/buildcraft/transport/render/RenderPipe.java index a005062d..16754c69 100644 --- a/common/buildcraft/transport/render/RenderPipe.java +++ b/common/buildcraft/transport/render/RenderPipe.java @@ -369,7 +369,7 @@ public class RenderPipe extends TileEntitySpecialRenderer { default: } func_110628_a(TextureMap.field_110575_b); - FluidRenderer.colorFluid(liquid); + FluidRenderer.setColorForFluidStack(liquid); GL11.glCallList(list); GL11.glPopMatrix(); } @@ -384,7 +384,7 @@ public class RenderPipe extends TileEntitySpecialRenderer { int stage = (int) ((float) liquid.amount / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1)); func_110628_a(TextureMap.field_110575_b); - FluidRenderer.colorFluid(liquid); + FluidRenderer.setColorForFluidStack(liquid); if (above) { GL11.glCallList(d.centerVertical[stage]);