Skip to content

Commit

Permalink
fix fluids being darker in gt guis
Browse files Browse the repository at this point in the history
  • Loading branch information
TechLord22 committed Dec 14, 2021
1 parent 36c6c96 commit 013926b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ public static void register() {
.build();

Tin = new Material.Builder(112, "tin")
.ingot(1).fluid().ore()
.ingot(1).fluid(FluidType.FLUID, true).ore()
.color(0xDCDCDC)
.flags(EXT2_METAL, MORTAR_GRINDABLE, GENERATE_ROTOR, GENERATE_SPRING, GENERATE_SPRING_SMALL)
.element(Elements.Sn)
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/gregtech/client/utils/RenderUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,8 @@ public static void drawFluidForGui(FluidStack contents, int tankCapacity, int st
}
GlStateManager.enableBlend();
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
setGlColorFromInt(fluidColor, 200);
// fluid is RGBA for GT guis, despite MC's fluids being ARGB
setGlColorFromInt(fluidColor, fluidColor & 0x000000FF);

final int xTileCount = widthT / 16;
final int xRemainder = widthT - xTileCount * 16;
Expand Down Expand Up @@ -553,16 +554,16 @@ public static int packColor(int red, int green, int blue, int alpha) {
}

public static void setGlColorFromInt(int colorValue, int opacity) {
int i = (colorValue & 16711680) >> 16;
int j = (colorValue & 65280) >> 8;
int k = (colorValue & 255);
int i = (colorValue & 0xFF0000) >> 16;
int j = (colorValue & 0xFF00) >> 8;
int k = (colorValue & 0xFF);
GlStateManager.color(i / 255.0f, j / 255.0f, k / 255.0f, opacity / 255.0f);
}

public static void setGlClearColorFromInt(int colorValue, int opacity) {
int i = (colorValue & 16711680) >> 16;
int j = (colorValue & 65280) >> 8;
int k = (colorValue & 255);
int i = (colorValue & 0xFF0000) >> 16;
int j = (colorValue & 0xFF00) >> 8;
int k = (colorValue & 0xFF);
GlStateManager.clearColor(i / 255.0f, j / 255.0f, k / 255.0f, opacity / 255.0f);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gregtech/common/MetaFluids.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public static Fluid registerFluid(Material material, FluidType fluidType, int te
if (material.hasFluidColor())
fluid.setColor(GTUtility.convertRGBtoOpaqueRGBA_MC(material.getMaterialRGB()));
else
fluid.setColor(GTUtility.convertRGBtoOpaqueRGBA_MC(0xFFFFFF));
fluid.setColor(0xFFFFFFFF);

// set properties and register
setStateProperties(fluid, fluidState);
Expand Down

0 comments on commit 013926b

Please sign in to comment.