diff --git a/src/main/java/meteordevelopment/meteorclient/systems/hud/Hud.java b/src/main/java/meteordevelopment/meteorclient/systems/hud/Hud.java index aad026952a..04d89ec506 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/hud/Hud.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/hud/Hud.java @@ -8,6 +8,7 @@ import meteordevelopment.meteorclient.events.meteor.CustomFontChangedEvent; import meteordevelopment.meteorclient.events.render.Render2DEvent; import meteordevelopment.meteorclient.events.world.TickEvent; +import meteordevelopment.meteorclient.gui.WidgetScreen; import meteordevelopment.meteorclient.settings.*; import meteordevelopment.meteorclient.systems.System; import meteordevelopment.meteorclient.systems.Systems; @@ -51,6 +52,13 @@ public class Hud extends System implements Iterable { .build() ); + private final Setting hideInMenus = sgGeneral.add(new BoolSetting.Builder() + .name("hide-in-menus") + .description("Hides the meteor hud when in inventory screens or game menus.") + .defaultValue(false) + .build() + ); + private final Setting textScale = sgGeneral.add(new DoubleSetting.Builder() .name("text-scale") .description("Scale of text if not overridden by the element.") @@ -214,7 +222,9 @@ private void onTick(TickEvent.Post event) { @EventHandler private void onRender(Render2DEvent event) { if (Utils.isLoading()) return; - if (!(active && ((!mc.options.hudHidden && !mc.options.debugEnabled) || HudEditorScreen.isOpen()))) return; + + if (!active || shouldHideHud()) return; + if ((mc.options.hudHidden || mc.options.debugEnabled) && !HudEditorScreen.isOpen()) return; HudRenderer.INSTANCE.begin(event.drawContext); @@ -227,6 +237,10 @@ private void onRender(Render2DEvent event) { HudRenderer.INSTANCE.end(); } + private boolean shouldHideHud() { + return hideInMenus.get() && mc.currentScreen != null && !(mc.currentScreen instanceof WidgetScreen); + } + @EventHandler private void onCustomFontChanged(CustomFontChangedEvent event) { if (customFont.get()) {