aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-08-17 09:38:24 +0200
committerGitHub <noreply@github.com>2022-08-17 09:38:24 +0200
commit5d2aa40fdee044c0579f426bff279b9d631e306f (patch)
tree9596afb42da307f874b0bb06ae5aeeae04465aea /src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
parent1d23d88488f1266538275e3c069916c1fec58281 (diff)
downloadnotenoughupdates-5d2aa40fdee044c0579f426bff279b9d631e306f.tar.gz
notenoughupdates-5d2aa40fdee044c0579f426bff279b9d631e306f.tar.bz2
notenoughupdates-5d2aa40fdee044c0579f426bff279b9d631e306f.zip
Probably fixing Lag spikes (#229)
* using method getOpenChestName instead of field lastOpenContainerName * probably fixing lag spikes in power stone stats display * using new getOpenChestName in EnchantingSolvers
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
index 9419be4f..8bd7c581 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
@@ -88,7 +88,11 @@ public class SBInfo {
public Date currentTimeDate = null;
- public String lastOpenContainerName = "";
+ /**
+ * Use Utils.getOpenChestName() instead
+ */
+ @Deprecated
+ public String currentlyOpenChestName = "";
private long lastManualLocRaw = -1;
private long lastLocRaw = -1;
@@ -131,19 +135,18 @@ public class SBInfo {
GuiChest chest = (GuiChest) event.gui;
ContainerChest container = (ContainerChest) chest.inventorySlots;
- lastOpenContainerName = container.getLowerChestInventory().getDisplayName().getUnformattedText();
+ currentlyOpenChestName = container.getLowerChestInventory().getDisplayName().getUnformattedText();
+ } else {
+ currentlyOpenChestName = "";
}
}
@SubscribeEvent
public void onGuiTick(TickEvent event) {
if (tickCount++ % 10 != 0) return;
- GuiScreen currentScreen = Minecraft.getMinecraft().currentScreen;
- if (currentScreen instanceof GuiChest) {
- ContainerChest container = (ContainerChest) ((GuiChest) currentScreen).inventorySlots;
- if ("Profile Management".equals(container.getLowerChestInventory().getDisplayName().getUnformattedText())) {
- updateProfileInformation(container);
- }
+ if (Utils.getOpenChestName().equals("Profile Management")) {
+ ContainerChest container = (ContainerChest) ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots;
+ updateProfileInformation(container);
}
}
@@ -226,7 +229,7 @@ public class SBInfo {
locraw = null;
this.setLocation(null);
joinedWorld = System.currentTimeMillis();
- lastOpenContainerName = "";
+ currentlyOpenChestName = "";
hasNewTab = false;
}