diff options
| author | Roman / Linnea Gräf <roman.graef@gmail.com> | 2022-12-09 13:19:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-09 23:19:54 +1100 |
| commit | 337b77aa50db6b4a159795827623d36acccbdcc4 (patch) | |
| tree | 07b107d9925de565e78bf02a1526881bd05b1519 /src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java | |
| parent | ac74ab8c13cf486cf36cb911f0a723908b0c5072 (diff) | |
| download | notenoughupdates-337b77aa50db6b4a159795827623d36acccbdcc4.tar.gz notenoughupdates-337b77aa50db6b4a159795827623d36acccbdcc4.tar.bz2 notenoughupdates-337b77aa50db6b4a159795827623d36acccbdcc4.zip | |
Katting (#447)
Co-authored-by: nea <romangraef@gmail.com>
Co-authored-by: nea <roman.graef@gmail.com>
Co-authored-by: nea <nea@nea.moe>
Co-authored-by: nea <romangraef@loves.dicksinhisan.us>
Co-authored-by: nea <roman.graef@grb-online.net>
Co-authored-by: nea <hello@nea89.moe>
Co-authored-by: nea <roman.graef@stud.tu-darmstadt.de>
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java index 3e2dd465..2ff9692d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java @@ -189,6 +189,16 @@ public class ItemUtils { } public static ItemStack createPetItemstackFromPetInfo(PetInfoOverlay.Pet currentPet) { + if (currentPet == null) { + ItemStack stack = ItemUtils.createQuestionMarkSkull(EnumChatFormatting.RED + "Unknown Pet"); + appendLore(stack, Arrays.asList( + "§cNull Pet", + "", + "§cIf you expected it to be there please send a message in", + "§c§l#neu-support §r§con §ldiscord.gg/moulberry" + )); + return stack; + } String petname = currentPet.petType; String tier = Utils.getRarityFromInt(currentPet.rarity.petId).toUpperCase(); String heldItem = currentPet.petItem; @@ -196,11 +206,13 @@ public class ItemUtils { JsonObject heldItemJson = heldItem == null ? null : NotEnoughUpdates.INSTANCE.manager.getItemInformation().get( heldItem); String petId = currentPet.getPetId(false); - float exp = currentPet.petLevel.totalXp; + float exp = currentPet.petLevel.getExpTotal(); - GuiProfileViewer.PetLevel levelObj = GuiProfileViewer.getPetLevel(petname, tier, exp); + PetLeveling.PetLevel levelObj = PetLeveling + .getPetLevelingForPet(petname, PetInfoOverlay.Rarity.valueOf(tier)) + .getPetLevel(exp); - float level = levelObj.level; + int level = levelObj.getCurrentLevel(); ItemStack petItemstack = NotEnoughUpdates.INSTANCE.manager .createItemResolutionQuery() @@ -348,7 +360,7 @@ public class ItemUtils { if (Utils.cleanColour(lore.getStringTagAt(0)).matches(ItemTooltipListener.petToolTipRegex) && lore.tagCount() > 7) { - GuiProfileViewer.PetLevel petLevel; + PetLeveling.PetLevel petLevel; PetInfoOverlay.Pet pet = PetInfoOverlay.getPetFromStack( stack.getTagCompound() @@ -373,13 +385,13 @@ public class ItemUtils { for (int i = 0; i < lore.tagCount(); i++) { if (i == lore.tagCount() - 2) { newLore.appendTag(new NBTTagString("")); - if (petLevel.level >= maxLvl) { + if (petLevel.getCurrentLevel() >= maxLvl) { newLore.appendTag(new NBTTagString( EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "MAX LEVEL")); } else { - double levelPercent = (Math.round(petLevel.levelPercentage * 1000) / 10.0); + double levelPercent = (Math.round(petLevel.getPercentageToNextLevel() * 1000) / 10.0); newLore.appendTag(new NBTTagString( - EnumChatFormatting.GRAY + "Progress to Level " + (int) (petLevel.level + 1) + ": " + + EnumChatFormatting.GRAY + "Progress to Level " + (petLevel.getCurrentLevel() + 1) + ": " + EnumChatFormatting.YELLOW + levelPercent + "%")); StringBuilder sb = new StringBuilder(); @@ -394,9 +406,9 @@ public class ItemUtils { newLore.appendTag(new NBTTagString(sb.toString())); newLore.appendTag(new NBTTagString( EnumChatFormatting.GRAY + "EXP: " + EnumChatFormatting.YELLOW + - decimalFormatter.format(petLevel.levelXp) + + decimalFormatter.format(petLevel.getExpInCurrentLevel()) + EnumChatFormatting.GOLD + "/" + EnumChatFormatting.YELLOW + - decimalFormatter.format(petLevel.currentLevelRequirement) + decimalFormatter.format(petLevel.getExpRequiredForNextLevel()) )); } } |
