From 6eff9e6bf5f8407fd3611278c0a0e82740480979 Mon Sep 17 00:00:00 2001 From: DStrand1 Date: Sat, 14 Aug 2021 19:45:39 -0500 Subject: [PATCH] fix Water missing fluid tooltip --- src/main/java/gregtech/api/util/FluidTooltipUtil.java | 4 +--- src/main/java/gregtech/common/ClientProxy.java | 4 ++-- src/main/java/gregtech/common/MetaFluids.java | 1 + 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/gregtech/api/util/FluidTooltipUtil.java b/src/main/java/gregtech/api/util/FluidTooltipUtil.java index 5722be0c774..8a6800ce8a9 100644 --- a/src/main/java/gregtech/api/util/FluidTooltipUtil.java +++ b/src/main/java/gregtech/api/util/FluidTooltipUtil.java @@ -1,7 +1,6 @@ package gregtech.api.util; import gregtech.api.unification.material.Materials; -import gregtech.api.unification.stack.MaterialStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -78,7 +77,6 @@ public static String getFluidTooltip(String fluidName) { * @return "H₂O" */ public static String getWaterTooltip() { - // Done like this to not return parenthesis around the tooltip - return (new MaterialStack(Materials.Hydrogen, 2)).toString() + "O"; + return Materials.Water.getChemicalFormula(); } } diff --git a/src/main/java/gregtech/common/ClientProxy.java b/src/main/java/gregtech/common/ClientProxy.java index 074e154abbd..afc45f2aaeb 100644 --- a/src/main/java/gregtech/common/ClientProxy.java +++ b/src/main/java/gregtech/common/ClientProxy.java @@ -151,7 +151,7 @@ public static void addMaterialFormulaHandler(ItemTooltipEvent event) { if (unificationEntry != null && unificationEntry.material != null) { chemicalFormula = unificationEntry.material.getChemicalFormula(); - // Test for Fluids + // Test for Fluids } else if (ItemNBTUtils.hasTag(itemStack)) { // Vanilla bucket @@ -165,7 +165,7 @@ public static void addMaterialFormulaHandler(ItemTooltipEvent event) { } } - // Water buckets have a separate registry name from other buckets + // Water buckets have a separate registry name from other buckets } else if (itemStack.getItem().equals(Items.WATER_BUCKET)) { chemicalFormula = FluidTooltipUtil.getWaterTooltip(); } diff --git a/src/main/java/gregtech/common/MetaFluids.java b/src/main/java/gregtech/common/MetaFluids.java index 3c1627b2aaa..9f31bcf06f1 100644 --- a/src/main/java/gregtech/common/MetaFluids.java +++ b/src/main/java/gregtech/common/MetaFluids.java @@ -164,6 +164,7 @@ public static void init() { // handle vanilla fluids Materials.Water.getProperty(PropertyKey.FLUID).setFluid(FluidRegistry.WATER); + FluidTooltipUtil.registerTooltip(FluidRegistry.WATER, Materials.Water.getChemicalFormula()); Materials.Lava.getProperty(PropertyKey.FLUID).setFluid(FluidRegistry.LAVA); //alternative names for forestry fluids