From db6699f888fbde5ef60a5584cde4c42f96d46b6a Mon Sep 17 00:00:00 2001 From: MachieCodes Date: Thu, 2 Jan 2025 15:09:37 -0600 Subject: [PATCH] Hide Hud While Active --- .../systems/modules/render/Zoom.java | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Zoom.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Zoom.java index ab96938886..062fa93417 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Zoom.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Zoom.java @@ -6,6 +6,8 @@ package meteordevelopment.meteorclient.systems.modules.render; import meteordevelopment.meteorclient.MeteorClient; +import meteordevelopment.meteorclient.events.meteor.KeyEvent; +import meteordevelopment.meteorclient.events.meteor.MouseButtonEvent; import meteordevelopment.meteorclient.events.meteor.MouseScrollEvent; import meteordevelopment.meteorclient.events.render.GetFovEvent; import meteordevelopment.meteorclient.events.render.Render3DEvent; @@ -18,6 +20,7 @@ import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.orbit.EventHandler; import net.minecraft.util.math.MathHelper; +import org.lwjgl.glfw.GLFW; public class Zoom extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); @@ -52,10 +55,18 @@ public class Zoom extends Module { .build() ); + private final Setting hideHud = sgGeneral.add(new BoolSetting.Builder() + .name("hide-HUD") + .description("Whether or not to hide the Minecraft HUD.") + .defaultValue(false) + .build() + ); + private final Setting renderHands = sgGeneral.add(new BoolSetting.Builder() .name("show-hands") .description("Whether or not to render your hands.") .defaultValue(false) + .visible(() -> !hideHud.get()) .build() ); @@ -66,6 +77,8 @@ public class Zoom extends Module { private double lastFov; private double time; + private boolean hudManualToggled; + public Zoom() { super(Categories.Render, "zoom", "Zooms your view."); autoSubscribe = false; @@ -83,6 +96,30 @@ public void onActivate() { MeteorClient.EVENT_BUS.subscribe(this); enabled = true; } + + if (hideHud.get() && !mc.options.hudHidden) { + hudManualToggled = false; + mc.options.hudHidden = true; + } + } + + @Override + public void onDeactivate() { + if (hideHud.get() && !hudManualToggled) { + mc.options.hudHidden = false; + } + } + + @EventHandler + public void onKeyPressed(KeyEvent event) { + if (event.key != GLFW.GLFW_KEY_F1) return; + hudManualToggled = true; + } + + @EventHandler + public void onMouseButtonPressed(MouseButtonEvent event) { + if (event.button != GLFW.GLFW_KEY_F1) return; + hudManualToggled = true; } public void onStop() {