From 52aa971ea53d3540010d1aede2fe9885461ff8dd Mon Sep 17 00:00:00 2001 From: Cow Date: Tue, 25 Jul 2023 23:11:11 +0200 Subject: Fixed detection of bestiary overview GUI --- .../java/de/cowtipper/cowlection/data/BestiaryEntry.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/main/java/de/cowtipper/cowlection/data/BestiaryEntry.java') diff --git a/src/main/java/de/cowtipper/cowlection/data/BestiaryEntry.java b/src/main/java/de/cowtipper/cowlection/data/BestiaryEntry.java index a6c78e7..956422c 100644 --- a/src/main/java/de/cowtipper/cowlection/data/BestiaryEntry.java +++ b/src/main/java/de/cowtipper/cowlection/data/BestiaryEntry.java @@ -40,6 +40,8 @@ public class BestiaryEntry { spacerChar = ' '; } + private boolean isMaxed; + public BestiaryEntry(String mobName, int currentKills, int killsGoal) { this.mobName = mobName; this.killsToGo = killsGoal - currentKills; @@ -61,14 +63,15 @@ public class BestiaryEntry { } /** - * Bestiary not unlocked yet + * Bestiary is maxed (when isMaxed=true), or has not been unlocked yet (when isMaxed=false) */ - public BestiaryEntry(String mobName) { + public BestiaryEntry(String mobName, boolean isMaxed) { this.mobName = mobName; mobNameWidth = -1; - killsToGo = Integer.MAX_VALUE; + killsToGo = Integer.MAX_VALUE - (isMaxed ? 0 : 1); killsGoal = -1; - percentageToGo = Integer.MAX_VALUE; + percentageToGo = Integer.MAX_VALUE - (isMaxed ? 0 : 1); + this.isMaxed = isMaxed; } public static void reinitialize(ItemStack triggerItem) { @@ -96,7 +99,10 @@ public class BestiaryEntry { } public String getFormattedOutput(boolean sortBestiaryOverviewByKills) { - if (percentageToGo == Integer.MAX_VALUE) { + if (isMaxed) { + return mobName + EnumChatFormatting.WHITE + ": maxed!"; + } + if (percentageToGo == Integer.MAX_VALUE - 1) { return mobName + EnumChatFormatting.GRAY + ": not unlocked yet"; } -- cgit