diff options
author | NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> | 2022-12-31 14:06:45 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-31 04:06:45 +0100 |
commit | fbdbde5ea7db57e41e4defd4377ec2d4773f315d (patch) | |
tree | 5d82b05cf44d20fe4af068f6373b4b3b73dee6a3 | |
parent | 103c2ed444d2f4d3becd300fb169b3e60b468c47 (diff) | |
download | NotEnoughUpdates-fbdbde5ea7db57e41e4defd4377ec2d4773f315d.tar.gz NotEnoughUpdates-fbdbde5ea7db57e41e4defd4377ec2d4773f315d.tar.bz2 NotEnoughUpdates-fbdbde5ea7db57e41e4defd4377ec2d4773f315d.zip |
fix current xp showing above max xp for level 100 (#515)
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java index 13179179..37cb14b5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java @@ -496,7 +496,7 @@ public class PetInfoOverlay extends TextOverlay { DecimalFormat df = new DecimalFormat("#.#", DecimalFormatSymbols.getInstance(Locale.ENGLISH)); if (pet == null) return 0; try { - return Float.parseFloat(df.format(pet.petLevel.getPercentageToNextLevel() * 100f)); + return Float.parseFloat(df.format(Math.min(pet.petLevel.getPercentageToNextLevel() * 100f, 100f))); } catch (Exception ignored) { return 0; } @@ -516,7 +516,8 @@ public class PetInfoOverlay extends TextOverlay { roundFloat(currentPet.petLevel.getExpRequiredForNextLevel()) + EnumChatFormatting.YELLOW + " (" + getLevelPercent(currentPet) + "%)"; - String lvlString = EnumChatFormatting.AQUA + "" + Utils.shortNumberFormat(levelXp, 0) + "/" + + String lvlString = EnumChatFormatting.AQUA + "" + + Utils.shortNumberFormat(Math.min(levelXp, currentPet.petLevel.getExpRequiredForNextLevel()), 0) + "/" + Utils.shortNumberFormat(currentPet.petLevel.getExpRequiredForNextLevel(), 0) + EnumChatFormatting.YELLOW + " (" + getLevelPercent(currentPet) + "%)"; |