From a6b5448d962792e647d9ea67067dec8360925997 Mon Sep 17 00:00:00 2001 From: NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> Date: Wed, 2 Nov 2022 15:59:07 +0000 Subject: Added the extra MP that abicases give to pv (#409) Made the abicase give the extra powder --- .../notenoughupdates/profileviewer/InventoriesPage.java | 3 ++- .../notenoughupdates/profileviewer/PlayerStats.java | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java index b4f1da30..a981183a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java @@ -127,6 +127,7 @@ public class InventoriesPage extends GuiProfileViewerPage { ProfileViewer.Profile profile = GuiProfileViewer.getProfile(); String profileId = GuiProfileViewer.getProfileId(); JsonObject inventoryInfo = profile.getInventoryInfo(profileId); + JsonObject profileInformation = profile.getProfileInformation(profileId); if (inventoryInfo == null) return; int invNameIndex = 0; @@ -153,7 +154,7 @@ public class InventoriesPage extends GuiProfileViewerPage { getInstance().tooltipToDisplay = entry.getValue().getTooltip(Minecraft.getMinecraft().thePlayer, false); if (Objects.equals(entry.getKey(), "talisman_bag")) { StringBuilder magicalPowerString = new StringBuilder(EnumChatFormatting.DARK_GRAY + "Magical Power: "); - int magicalPower = PlayerStats.getMagicalPower(inventoryInfo); + int magicalPower = PlayerStats.getMagicalPower(inventoryInfo, profileInformation); getInstance() .tooltipToDisplay.add( magicalPower == -1 diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java index b0cc930a..c5a17aef 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java @@ -657,7 +657,7 @@ public class PlayerStats { * @return the amount of Magical Power or -1 * @see io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer.Profile#getInventoryInfo(String) */ - public static int getMagicalPower(JsonObject inventoryInfo) { + public static int getMagicalPower(JsonObject inventoryInfo, JsonObject profileInfo) { if (inventoryInfo == null || !inventoryInfo.has("talisman_bag") || !inventoryInfo.get("talisman_bag").isJsonArray()) { return -1; } @@ -705,6 +705,16 @@ public class PlayerStats { break; } } + if (entry.getKey().equals("ABICASE")) { + if (profileInfo.has("nether_island_player_data") && + profileInfo.get("nether_island_player_data").getAsJsonObject().has("abiphone") && profileInfo.get( + "nether_island_player_data").getAsJsonObject().get("abiphone").getAsJsonObject().has("active_contacts")) { // BatChest + int contact = + profileInfo.get("nether_island_player_data").getAsJsonObject().get("abiphone").getAsJsonObject().get( + "active_contacts").getAsJsonArray().size(); + powderAmount += Math.floor(contact / 2); + } + } switch (entry.getValue()) { case 0: case 6: -- cgit