Patch the pluralization function in Ihan Crystal
This commit is contained in:
parent
a8f11edb5f
commit
81fa85ddee
1 changed files with 6 additions and 1 deletions
|
@ -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
|
||||
|
|
Reference in a new issue