diff options
author | DoKM <mcazzyman@gmail.com> | 2021-08-23 17:58:53 +0200 |
---|---|---|
committer | DoKM <mcazzyman@gmail.com> | 2021-08-23 17:58:53 +0200 |
commit | 3ff239d48b8b45e86efae37b8e9b1963927a6d8c (patch) | |
tree | d02e56e2e5d468582825460077a385af613eaaa1 /src/main | |
parent | ec182b6c75b00dc8fc265ae48ae3eef4d6e58e33 (diff) | |
download | NotEnoughUpdates-3ff239d48b8b45e86efae37b8e9b1963927a6d8c.tar.gz NotEnoughUpdates-3ff239d48b8b45e86efae37b8e9b1963927a6d8c.tar.bz2 NotEnoughUpdates-3ff239d48b8b45e86efae37b8e9b1963927a6d8c.zip |
fix a small bug and some code clean up in pet exp extender
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index c499ce0f..fbf51fca 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -2390,13 +2390,6 @@ public class NEUEventListener { if (Utils.cleanColour(event.toolTip.get(1)).matches("((Farming)|(Combat)|(Fishing)|(Mining)|(Foraging)|(Enchanting)|(Alchemy)) ((Mount)|(Pet)).*")) { GuiProfileViewer.PetLevel petlevel = null; - PetInfoOverlay.Pet pet = PetInfoOverlay.getPetFromStack(event.itemStack.getDisplayName(), NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(event.itemStack.getTagCompound())); - if (pet == null) { - return; - } - petlevel = pet.petLevel; - - boolean maxLevel = false; int xpLine = -1; for (int i = event.toolTip.size() - 1; i >= 0; i--) { Matcher matcher = xpLevelPattern.matcher(event.toolTip.get(i)); @@ -2405,19 +2398,22 @@ public class NEUEventListener { event.toolTip.set(xpLine, matcher.group(1)); break; } else if (event.toolTip.get(i).matches("MAX LEVEL")) { - xpLine = i; - maxLevel = true; + return; } } + PetInfoOverlay.Pet pet = PetInfoOverlay.getPetFromStack(event.itemStack.getDisplayName(), NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(event.itemStack.getTagCompound())); + if (pet == null) { + return; + } + petlevel = pet.petLevel; + if (petlevel == null||xpLine==-1) { return; } + event.toolTip.add(xpLine+1, EnumChatFormatting.YELLOW + "" + myFormatter.format(petlevel.levelXp) + "/" + myFormatter.format(petlevel.currentLevelRequirement) + " EXP"); - if (!maxLevel) { - event.toolTip.add(event.toolTip.size() - 2, EnumChatFormatting.YELLOW + "" + myFormatter.format(petlevel.levelXp) + "/" + myFormatter.format(petlevel.currentLevelRequirement) + " EXP"); - } } } } |