Skip to content

Commit

Permalink
Simplify now duplicated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
pupnewfster committed Jul 8, 2019
1 parent de1bd30 commit 315f961
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
Expand Up @@ -27,7 +27,7 @@ protected void displayGauge(int xPos, int yPos, int scale, FluidStack fluid, int
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
int start = 0;
MekanismRenderer.colorFluidGLSM(fluid);
MekanismRenderer.colorFluid(fluid);
TextureAtlasSprite fluidTexture = MekanismRenderer.getFluidTexture(fluid, FluidType.STILL);
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
while (true) {
Expand Down
11 changes: 2 additions & 9 deletions src/main/java/mekanism/client/render/MekanismRenderer.java
Expand Up @@ -298,14 +298,7 @@ public static void disableCullFace() {
GlStateManager.disableCull();
}

public static void colorFluidGLSM(FluidStack fluid) {
int color = fluid.getFluid().getColor(fluid);
if (color != -1) {
colorGLSM(color);
}
}

public static void colorGLSM(int color) {
public static void colorAlpha(int color) {
float red = (color >> 16 & 0xFF) / 255.0F;
float green = (color >> 8 & 0xFF) / 255.0F;
float blue = (color & 0xFF) / 255.0F;
Expand All @@ -314,7 +307,7 @@ public static void colorGLSM(int color) {
}

public static void colorFluid(FluidStack fluid) {
color(fluid.getFluid().getColor(fluid));
colorAlpha(fluid.getFluid().getColor(fluid));
}

public static void color(int color) {
Expand Down
Expand Up @@ -74,7 +74,7 @@ public void render(TileEntityMechanicalPipe pipe, double x, double y, double z,
GlStateManager.disableBlend();

MekanismRenderer.glowOn(fluid.getLuminosity());
MekanismRenderer.color(fluidStack != null ? fluidStack.getFluid().getColor(fluidStack) : fluid.getColor());
MekanismRenderer.colorAlpha(fluidStack != null ? fluidStack.getFluid().getColor(fluidStack) : fluid.getColor());

bindTexture(MekanismRenderer.getBlocksTexture());
GlStateManager.translate(x, y, z);
Expand Down

0 comments on commit 315f961

Please sign in to comment.