From 7e0f0f687feefed0990c6cc3076d6171d7c61f8b Mon Sep 17 00:00:00 2001 From: Mary <33456283+FourIsTheNumber@users.noreply.github.com> Date: Thu, 14 Nov 2024 13:39:25 -0500 Subject: [PATCH] Add tooltips to fluid/item pipe casings (#3492) Co-authored-by: Martin Robertz --- .../java/gregtech/common/blocks/ItemCasings11.java | 14 ++++++++++++++ .../java/gregtech/common/blocks/ItemCasings2.java | 14 ++++++++++++-- src/main/resources/assets/gregtech/lang/en_US.lang | 2 ++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/main/java/gregtech/common/blocks/ItemCasings11.java b/src/main/java/gregtech/common/blocks/ItemCasings11.java index 5cae92a55d1..4dbac9b1c70 100644 --- a/src/main/java/gregtech/common/blocks/ItemCasings11.java +++ b/src/main/java/gregtech/common/blocks/ItemCasings11.java @@ -1,6 +1,12 @@ package gregtech.common.blocks; +import java.util.List; + import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; /** * The casings are split into separate files because they are registered as regular blocks, and a regular block can have @@ -11,4 +17,12 @@ public class ItemCasings11 extends ItemCasingsAbstract { public ItemCasings11(Block block) { super(block); } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { + aList.add( + StatCollector.translateToLocalFormatted( + "gt.casing.tiertooltip", + (EnumChatFormatting.YELLOW + Integer.toString(getDamage(aStack) + 1)))); + } } diff --git a/src/main/java/gregtech/common/blocks/ItemCasings2.java b/src/main/java/gregtech/common/blocks/ItemCasings2.java index b0981c0dc30..e27438be0a8 100644 --- a/src/main/java/gregtech/common/blocks/ItemCasings2.java +++ b/src/main/java/gregtech/common/blocks/ItemCasings2.java @@ -5,6 +5,8 @@ import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; /** * The casings are split into separate files because they are registered as regular blocks, and a regular block can have @@ -19,8 +21,16 @@ public ItemCasings2(Block block) { @Override public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { super.addInformation(aStack, aPlayer, aList, aF3_H); - if (getDamage(aStack) == 8) { - aList.add(this.mBlastProofTooltip); + switch (getDamage(aStack)) { + case 8 -> aList.add(this.mBlastProofTooltip); + case 12 -> aList + .add(StatCollector.translateToLocalFormatted("gt.casing.tiertooltip", EnumChatFormatting.YELLOW + "1")); + case 13 -> aList + .add(StatCollector.translateToLocalFormatted("gt.casing.tiertooltip", EnumChatFormatting.YELLOW + "2")); + case 14 -> aList + .add(StatCollector.translateToLocalFormatted("gt.casing.tiertooltip", EnumChatFormatting.YELLOW + "3")); + case 15 -> aList + .add(StatCollector.translateToLocalFormatted("gt.casing.tiertooltip", EnumChatFormatting.YELLOW + "4")); } } } diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang index eac9f279ff4..0ed55b6ee28 100644 --- a/src/main/resources/assets/gregtech/lang/en_US.lang +++ b/src/main/resources/assets/gregtech/lang/en_US.lang @@ -104,6 +104,8 @@ GT5U.coil.MAX=Eternal GT5U.MS.multismelting=Multi smelting +gt.casing.tiertooltip=Casing Tier: %s + # Machine types gt.recipe.alloysmelter=Alloy Smelter gt.recipe.alloysmelter.description=HighTech combination Smelter