From d28081d8cd0573be977211cbca75ffac926b210b Mon Sep 17 00:00:00 2001 From: Lulonaut Date: Thu, 4 Jan 2024 11:14:14 +0100 Subject: fix minion helper overlay (#988) --- .../miscgui/minionhelper/loaders/MinionHelperApiLoader.java | 6 +++--- .../miscgui/minionhelper/loaders/MinionHelperInventoryLoader.java | 5 +++-- 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 craftedMinions = new ArrayList<>(); for (Map.Entry 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"); -- cgit