From ce85f467928e085d4756c04cdf60b6a330b756e3 Mon Sep 17 00:00:00 2001 From: efefury <69400149+efefury@users.noreply.github.com> Date: Wed, 31 Aug 2022 11:37:01 +0000 Subject: fixed itemeditor (#248) and cool bestiary page changes --- .../notenoughupdates/itemeditor/NEUItemEditor.java | 20 +++++++++++++++++--- .../profileviewer/bestiary/BestiaryPage.java | 18 ++++++++++-------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java index 3d18df36..9dc8d8b0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java @@ -89,9 +89,23 @@ public class NEUItemEditor extends GuiScreen { } catch (NBTException ignored) { } } - nbtTag.getCompoundTag("ExtraAttributes").removeTag("uuid"); - nbtTag.getCompoundTag("ExtraAttributes").removeTag("timestamp"); + NBTTagCompound extraAttributes = nbtTag.getCompoundTag("ExtraAttributes"); + extraAttributes.removeTag("uuid"); + extraAttributes.removeTag("timestamp"); + if (extraAttributes.hasKey("petInfo")) { + try { + NBTTagCompound petInfo = JsonToNBT.getTagFromJson(extraAttributes.getString("petInfo")); + + petInfo.removeTag("\"heldItem\""); + petInfo.setString("\"exp\"", "0.0"); + petInfo.setString("\"candyUsed\"", "0"); + petInfo.removeTag("\"uuid\""); + + extraAttributes.setString("petInfo", petInfo.toString()); + } catch (NBTException ignored) { + } + } savedRepoItem = NotEnoughUpdates.INSTANCE.manager.getItemInformation().getOrDefault(internalName, null); internalName = internalName == null ? "" : internalName; @@ -161,7 +175,7 @@ public class NEUItemEditor extends GuiScreen { rightOptions.add(new GuiElementButton("Remove enchants", Color.RED.getRGB(), () -> { nbtTag.removeTag("ench"); - nbtTag.getCompoundTag("ExtraAttributes").removeTag("enchantments"); + extraAttributes.removeTag("enchantments"); })); rightOptions.add(new GuiElementButton( "Add enchant glint", diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryPage.java index b37aa73f..3dc97a85 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryPage.java @@ -196,14 +196,16 @@ public class BestiaryPage extends GuiProfileViewerPage { EnumChatFormatting.GRAY + "Deaths: " + EnumChatFormatting.GREEN + numberFormat.format(deaths) ); if (level != null) { - tooltipToDisplay.add( - EnumChatFormatting.GRAY + - "Progress: " + - EnumChatFormatting.AQUA + - GuiProfileViewer.shortNumberFormat(Math.round((levelNum % 1) * level.maxXpForLevel), 0) + - "/" + - GuiProfileViewer.shortNumberFormat(level.maxXpForLevel, 0) - ); + String progressStr; + if (level.maxed) { + progressStr = EnumChatFormatting.GOLD + "MAXED!"; + } else { + progressStr = EnumChatFormatting.AQUA + + GuiProfileViewer.shortNumberFormat(Math.round((levelNum % 1) * level.maxXpForLevel), 0) + + "/" + + GuiProfileViewer.shortNumberFormat(level.maxXpForLevel, 0); + } + tooltipToDisplay.add(EnumChatFormatting.GRAY + "Progress: " + progressStr); } } } -- cgit