From 3ee496ecb794c4b7073d77e2074644104d0a5eeb Mon Sep 17 00:00:00 2001 From: Lulonaut Date: Thu, 6 Jul 2023 01:51:36 +0200 Subject: Fix Magical Power calculation (#754) --- .../notenoughupdates/profileviewer/ProfileViewerUtils.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java index 8a04e0ff..d8f7d17e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java @@ -106,6 +106,9 @@ public class ProfileViewerUtils { )); Set ignoredTalismans = new HashSet<>(); + + // While there are several crab hats, only one of them counts towards the magical power + boolean countedCrabHat = false; int powerAmount = 0; for (Map.Entry entry : accessories.entrySet()) { if (ignoredTalismans.contains(entry.getKey())) continue; @@ -127,6 +130,7 @@ public class ProfileViewerUtils { break; } } + if (entry.getKey().equals("ABICASE")) { if (profileInfo != null && profileInfo.has("nether_island_player_data")) { JsonObject data = profileInfo.get("nether_island_player_data").getAsJsonObject(); @@ -136,6 +140,12 @@ public class ProfileViewerUtils { } } } + + if (entry.getKey().startsWith("PARTY_HAT")) { + if (countedCrabHat) continue; + countedCrabHat = true; + } + switch (entry.getValue()) { case 0: case 6: -- cgit