Merge pull request #1088 from Soaryn/patch-1

Fixes Fluid Color Render
This commit is contained in:
CovertJaguar 2013-08-04 02:00:02 -07:00
commit a5be4d79c4
5 changed files with 24 additions and 2 deletions

View file

@ -182,6 +182,13 @@ public abstract class GuiAdvancedInterface extends GuiBuildCraft {
super(x, y);
}
@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);
}
@Override
public Icon getIcon() {
return FluidRenderer.getFluidTexture(fluid, false);

View file

@ -76,6 +76,15 @@ public class FluidRenderer {
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 int[] getFluidDisplayLists(FluidStack fluidStack, World world, boolean flowing) {
if (fluidStack == null) {
return null;

View file

@ -182,6 +182,7 @@ public class RenderRefinery extends TileEntitySpecialRenderer implements IInvent
if (list1 != null) {
func_110628_a(FluidRenderer.getFluidSheet(liquid1));
FluidRenderer.colorFluid(liquid1);
GL11.glCallList(list1[(int) ((float) liquid1.amount / (float) TileRefinery.LIQUID_PER_SLOT * (FluidRenderer.DISPLAY_STAGES - 1))]);
}
}
@ -193,6 +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);
GL11.glCallList(list2[(int) ((float) liquid2.amount / (float) TileRefinery.LIQUID_PER_SLOT * (FluidRenderer.DISPLAY_STAGES - 1))]);
GL11.glPopMatrix();
}
@ -206,6 +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);
GL11.glCallList(list3[(int) ((float) liquidResult.amount / (float) TileRefinery.LIQUID_PER_SLOT * (FluidRenderer.DISPLAY_STAGES - 1))]);
GL11.glPopMatrix();
}

View file

@ -39,6 +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);
GL11.glTranslatef((float) x + 0.125F, (float) y, (float) z + 0.125F);
GL11.glScalef(0.75F, 0.999F, 0.75F);

View file

@ -368,6 +368,7 @@ public class RenderPipe extends TileEntitySpecialRenderer {
default:
}
func_110628_a(TextureMap.field_110575_b);
FluidRenderer.colorFluid(liquid);
GL11.glCallList(list);
GL11.glPopMatrix();
}
@ -382,6 +383,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);
if (above) {
GL11.glCallList(d.centerVertical[stage]);