Patch the pluralization function in Ihan Crystal

This commit is contained in:
Zontreck 2024-02-18 07:54:39 -07:00
parent a8f11edb5f
commit 81fa85ddee

View file

@ -51,7 +51,12 @@ public class IhanCrystal extends Item{
public void appendHoverText(ItemStack stack, Level p_41422_, List<Component> tooltip, TooltipFlag p_41424_) {
assertTag(stack);
tooltip.add(ChatHelpers.macro("!Dark_Green!Stored XP: !Dark_Red!" + stack.getTag().getInt(TAG_XP) + "!Dark_Green! level" + ((stack.getTag().getInt(TAG_XP)>1)?"levels" : "level")));
tooltip.add(ChatHelpers.macro("!Dark_Green!Stored XP: !Dark_Red!" + stack.getTag().getInt(TAG_XP) + "!Dark_Green! level" + Pluralize(stack.getTag().getInt(TAG_XP), "level")));
}
private String Pluralize(int num, String str) {
return "" + num + " " + (num > 1 ? str + "s" : str);
}
@Override