aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLulonaut <lulonaut@lulonaut.tech>2024-01-04 11:14:14 +0100
committerGitHub <noreply@github.com>2024-01-04 11:14:14 +0100
commitd28081d8cd0573be977211cbca75ffac926b210b (patch)
treeb62567b5c51a915bb36415ea5c0279f91541056b
parent998e57bd7d7c5e2855c434aa9b81a4f82507112f (diff)
downloadNotEnoughUpdates-d28081d8cd0573be977211cbca75ffac926b210b.tar.gz
NotEnoughUpdates-d28081d8cd0573be977211cbca75ffac926b210b.tar.bz2
NotEnoughUpdates-d28081d8cd0573be977211cbca75ffac926b210b.zip
fix minion helper overlay (#988)
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperInventoryLoader.java5
2 files changed, 6 insertions, 5 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java
index c9f67fd5..1f3bc0d1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java
@@ -201,8 +201,9 @@ public class MinionHelperApiLoader {
List<String> craftedMinions = new ArrayList<>();
for (Map.Entry<String, JsonElement> entry : members.entrySet()) {
JsonObject value = entry.getValue().getAsJsonObject();
- if (value.has("player_data.crafted_generators")) {
- for (JsonElement e : value.get("player_data.crafted_generators").getAsJsonArray()) {
+ for (JsonElement e : Utils
+ .getElementOrDefault(value, "player_data.crafted_generators", new JsonArray())
+ .getAsJsonArray()) {
String rawGenerator = e.getAsString();
String[] split = rawGenerator.split("_");
String tier = split[split.length - 1];
@@ -210,7 +211,6 @@ public class MinionHelperApiLoader {
String internalName = name + "_GENERATOR_" + tier;
craftedMinions.add(internalName);
}
- }
}
return craftedMinions;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperInventoryLoader.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperInventoryLoader.java
index 7fc703e6..c97ddbea 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperInventoryLoader.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperInventoryLoader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
+ * Copyright (C) 2022-2023 NotEnoughUpdates contributors
*
* This file is part of NotEnoughUpdates.
*
@@ -47,7 +47,8 @@ public class MinionHelperInventoryLoader {
private int ticks = 0;
//§7Craft §b5 §7more §aunique §7minions
- private final Pattern PATTERN_MINIONS_NEEDED = Pattern.compile("§7Craft §b(\\d+) §7more §aunique( §7minions)?");
+ private final Pattern PATTERN_MINIONS_NEEDED = Pattern.compile(
+ "^§7Craft §b(\\d+) §7more §aunique §7minions to unlock$");
//§r §r§fPelts: §r§59§r
private final Pattern PATTERN_PELTS = Pattern.compile("§r §r§fPelts: §r§5(\\d+)§r");