aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorheyngra <heyngra.wspolpraca@gmail.com>2022-12-09 12:45:03 +0100
committerGitHub <noreply@github.com>2022-12-09 22:45:03 +1100
commit1797440fcdc21c816c3d3a472f261c4e6da6f024 (patch)
tree9efdaf81d44cbf0bdaf781180a34ccd81d832ccc /src/main
parent77734f25f1e0b3d093e3506c059a97536b0f3972 (diff)
downloadNotEnoughUpdates-1797440fcdc21c816c3d3a472f261c4e6da6f024.tar.gz
NotEnoughUpdates-1797440fcdc21c816c3d3a472f261c4e6da6f024.tar.bz2
NotEnoughUpdates-1797440fcdc21c816c3d3a472f261c4e6da6f024.zip
Fix mining overlay not update while chat is opened (and more) (#481)
Fixes undefined
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java7
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/TextTabOverlay.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java2
3 files changed, 10 insertions, 12 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
index 025d4e21..f25407b6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
@@ -31,6 +31,7 @@ import io.github.moulberry.notenoughupdates.util.StarCultCalculator;
import io.github.moulberry.notenoughupdates.util.TabListUtils;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.init.Items;
@@ -450,8 +451,8 @@ public class MiningOverlay extends TextTabOverlay {
if (starCultDisplay) {
if(overlayStrings == null) overlayStrings = new ArrayList<>();
- if (!NotEnoughUpdates.INSTANCE.config.mining.forgeDisplayOnlyShowTab ||
- Keyboard.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindPlayerList.getKeyCode())) {
+ if (!NotEnoughUpdates.INSTANCE.config.mining.starCultDisplayOnlyShowTab ||
+ lastTabState) {
if (NotEnoughUpdates.INSTANCE.config.mining.starCultDisplayEnabledLocations == 1 &&
!SBInfo.getInstance().isInDungeon) {
overlayStrings.add(
@@ -469,7 +470,7 @@ public class MiningOverlay extends TextTabOverlay {
if(overlayStrings == null) overlayStrings = new ArrayList<>();
if (!NotEnoughUpdates.INSTANCE.config.mining.forgeDisplayOnlyShowTab ||
- Keyboard.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindPlayerList.getKeyCode())) {
+ lastTabState) {
if (NotEnoughUpdates.INSTANCE.config.mining.forgeDisplayEnabledLocations == 1 &&
!SBInfo.getInstance().isInDungeon) {
overlayStrings.addAll(getForgeStrings(profileConfig.forgeItems));
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextTabOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextTabOverlay.java
index fa263db7..c64fe21e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextTabOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextTabOverlay.java
@@ -36,7 +36,7 @@ public abstract class TextTabOverlay extends TextOverlay {
super(position, dummyStrings, styleSupplier);
}
- private boolean lastTabState = false;
+ protected boolean lastTabState = false;
private boolean shouldUpdateOverlay = true;
@Override
@@ -48,7 +48,7 @@ public abstract class TextTabOverlay extends TextOverlay {
public void realTick() {
shouldUpdateOverlay = shouldUpdate();
- if (shouldUpdateOverlay) {
+ if (!(Minecraft.getMinecraft().currentScreen instanceof GuiChat)) {
int keycode = Minecraft.getMinecraft().gameSettings.keyBindPlayerList.getKeyCode();
boolean currentTabState;
if (keycode > 0) {
@@ -58,17 +58,14 @@ public abstract class TextTabOverlay extends TextOverlay {
}
if (lastTabState != currentTabState) {
lastTabState = currentTabState;
- update();
}
+ } else lastTabState = false; // disallow showing overlays that use tab while having chat open
+ if (shouldUpdateOverlay) {
+ update();
}
}
private boolean shouldUpdate() {
- //prevent rendering when tab completing a command
- if (Minecraft.getMinecraft().currentScreen instanceof GuiChat) {
- return false;
- }
-
//prevent rendering when tab completing in ah search overlay
if (AuctionSearchOverlay.shouldReplace()) {
return false;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java
index a276f207..b35f06dc 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java
@@ -242,7 +242,7 @@ public class TimersOverlay extends TextTabOverlay {
if (hidden == null) return;
if (NotEnoughUpdates.INSTANCE.config.miscOverlays.todoOverlayOnlyShowTab &&
- !Keyboard.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindPlayerList.getKeyCode())) {
+ !lastTabState) {
overlayStrings = null;
return;
}