Skip to content

Commit

Permalink
Zoom Hide Hud Setting (#5080)
Browse files Browse the repository at this point in the history
  • Loading branch information
machiecodes authored Jan 3, 2025
1 parent b67a9b4 commit 40cfef1
Showing 1 changed file with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package meteordevelopment.meteorclient.systems.modules.render;

import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.events.meteor.KeyEvent;
import meteordevelopment.meteorclient.events.meteor.MouseScrollEvent;
import meteordevelopment.meteorclient.events.render.GetFovEvent;
import meteordevelopment.meteorclient.events.render.Render3DEvent;
Expand All @@ -18,6 +19,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 +54,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 +76,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 +95,24 @@ 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;
}

public void onStop() {
Expand Down Expand Up @@ -133,7 +163,7 @@ private void onRender3D(Render3DEvent event) {

@EventHandler
private void onGetFov(GetFovEvent event) {
event.fov /= getScaling();
event.fov /= (float) getScaling();

if (lastFov != event.fov) mc.worldRenderer.scheduleTerrainUpdate();
lastFov = event.fov;
Expand Down

0 comments on commit 40cfef1

Please sign in to comment.