aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/TextTabOverlay.java25
1 files changed, 21 insertions, 4 deletions
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 69a0cd00..8073062c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextTabOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextTabOverlay.java
@@ -36,12 +36,29 @@ public abstract class TextTabOverlay extends TextOverlay {
}
private boolean lastTabState = false;
+ private boolean shouldUpdateOverlay = true;
- public void realTick() {
- boolean currentTabState = Keyboard.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindPlayerList.getKeyCode());
- if (lastTabState != currentTabState) {
- lastTabState = currentTabState;
+ @Override
+ public void tick() {
+ if (shouldUpdateOverlay) {
update();
}
}
+
+ public void realTick() {
+ shouldUpdateOverlay = shouldUpdate();
+ if (shouldUpdateOverlay) {
+ boolean currentTabState =
+ Keyboard.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindPlayerList.getKeyCode());
+ if (lastTabState != currentTabState) {
+ lastTabState = currentTabState;
+ update();
+ }
+ }
+ }
+
+ private boolean shouldUpdate() {
+ //prevent rendering unless no gui is open
+ return Minecraft.getMinecraft().currentScreen == null;
+ }
}