Skip to content

Commit

Permalink
fix Water missing fluid tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
serenibyss committed Aug 15, 2021
1 parent ecae98a commit 6eff9e6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/main/java/gregtech/api/util/FluidTooltipUtil.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();
}
}
4 changes: 2 additions & 2 deletions src/main/java/gregtech/common/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/gregtech/common/MetaFluids.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6eff9e6

Please sign in to comment.