From 1797440fcdc21c816c3d3a472f261c4e6da6f024 Mon Sep 17 00:00:00 2001 From: heyngra Date: Fri, 9 Dec 2022 12:45:03 +0100 Subject: Fix mining overlay not update while chat is opened (and more) (#481) Fixes undefined --- .../moulberry/notenoughupdates/overlays/TextTabOverlay.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/overlays/TextTabOverlay.java') 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; -- cgit