aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PowerStoneStatsDisplay.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PowerStoneStatsDisplay.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PowerStoneStatsDisplay.java30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PowerStoneStatsDisplay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PowerStoneStatsDisplay.java
index 31dd71eb..907f0f0d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PowerStoneStatsDisplay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PowerStoneStatsDisplay.java
@@ -19,10 +19,13 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
+import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
+import io.github.moulberry.notenoughupdates.events.ProfileDataLoadedEvent;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
+import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewerUtils;
import io.github.moulberry.notenoughupdates.util.ItemUtils;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -54,13 +57,25 @@ public class PowerStoneStatsDisplay {
}
@SubscribeEvent
+ public void onProfileDataLoaded(ProfileDataLoadedEvent event) {
+ JsonObject profileInfo = event.getProfileInfo();
+
+ if (profileInfo == null) return;
+
+ JsonObject inventoryInfo = ProfileViewerUtils.readInventoryInfo(profileInfo, "talisman_bag");
+ if (inventoryInfo == null) return;
+
+ NEUConfig.HiddenProfileSpecific configProfileSpecific = NotEnoughUpdates.INSTANCE.config.getProfileSpecific();
+ if (configProfileSpecific == null) return;
+ int powerAmount = ProfileViewerUtils.getMagicalPower(inventoryInfo, profileInfo);
+ configProfileSpecific.magicalPower = powerAmount;
+ }
+
+ @SubscribeEvent
public void onTick(TickEvent event) {
+ if (!NotEnoughUpdates.INSTANCE.config.tooltipTweaks.powerStoneStats) return;
if (!dirty) return;
-
- if (!Utils.getOpenChestName().equals("SkyBlock Menu")) {
- dirty = false;
- return;
- }
+ if (!Utils.getOpenChestName().equals("Your Bags")) return;
EntityPlayerSP p = Minecraft.getMinecraft().thePlayer;
Container openContainer = p.openContainer;
@@ -70,14 +85,15 @@ public class PowerStoneStatsDisplay {
String displayName = stack.getDisplayName();
if (!"§aAccessory Bag".equals(displayName)) continue;
+ dirty = false;
for (String line : ItemUtils.getLore(stack)) {
if (line.startsWith("§7Magical Power: ")) {
String rawNumber = line.split("§6")[1].replace(",", "");
NEUConfig.HiddenProfileSpecific configProfileSpecific = NotEnoughUpdates.INSTANCE.config.getProfileSpecific();
if (configProfileSpecific == null) return;
- configProfileSpecific.magicalPower = Integer.parseInt(rawNumber);
- dirty = false;
+ int magicalPower = Integer.parseInt(rawNumber);
+ configProfileSpecific.magicalPower = magicalPower;
}
}
}