Skip to content

Commit

Permalink
Hide Hud While Active
Browse files Browse the repository at this point in the history
  • Loading branch information
machiecodes committed Jan 2, 2025
1 parent 967d584 commit db6699f
Showing 1 changed file with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down Expand Up @@ -52,10 +55,18 @@ public class Zoom extends Module {
.build()
);

private final Setting<Boolean> hideHud = sgGeneral.add(new BoolSetting.Builder()
.name("hide-HUD")
.description("Whether or not to hide the Minecraft HUD.")
.defaultValue(false)
.build()
);

private final Setting<Boolean> renderHands = sgGeneral.add(new BoolSetting.Builder()
.name("show-hands")
.description("Whether or not to render your hands.")
.defaultValue(false)
.visible(() -> !hideHud.get())
.build()
);

Expand All @@ -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;
Expand All @@ -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() {
Expand Down

0 comments on commit db6699f

Please sign in to comment.