aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorefefury <69400149+efefury@users.noreply.github.com>2022-08-31 11:37:01 +0000
committerGitHub <noreply@github.com>2022-08-31 13:37:01 +0200
commitce85f467928e085d4756c04cdf60b6a330b756e3 (patch)
tree31d611f80cea5b0dfb840540e45a921a6bd4eb44 /src
parent1f56794a823f4754f93e1128d6ba6f71ef2134d0 (diff)
downloadNotEnoughUpdates-ce85f467928e085d4756c04cdf60b6a330b756e3.tar.gz
NotEnoughUpdates-ce85f467928e085d4756c04cdf60b6a330b756e3.tar.bz2
NotEnoughUpdates-ce85f467928e085d4756c04cdf60b6a330b756e3.zip
fixed itemeditor (#248)
and cool bestiary page changes
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java20
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryPage.java18
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);
}
}
}