free-look module

free-look: Minecraft 26.3 cheat module, full source for every implementation (1 client: Meteor Client).

1 implementationRender

Clients with this module

Full module source: 1 implementation

Every implementation below is the complete module file, verbatim. Expand a client to read its code.

Meteor ClientRendersrc/main/java/meteordevelopment/meteorclient/systems/modules/render/FreeLook.javaJava · 132 lines · 4.5 KB

Allows more rotation options in third person.

Settingsmodetoggle-perspectivecamera-sensitivityarrows-control-oppositearrow-speed
FreeLook.javaJava · Minecraft 26.2 · 132 lines · 4.5 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
3
 * Copyright (c) Meteor Development.
4
 */
5
6
package meteordevelopment.meteorclient.systems.modules.render;
7
8
import meteordevelopment.meteorclient.events.world.TickEvent;
9
import meteordevelopment.meteorclient.settings.*;
10
import meteordevelopment.meteorclient.systems.modules.Categories;
11
import meteordevelopment.meteorclient.systems.modules.Module;
12
import meteordevelopment.meteorclient.utils.misc.input.Input;
13
import meteordevelopment.orbit.EventHandler;
14
import net.minecraft.client.CameraType;
15
import net.minecraft.util.Mth;
16
import com.mojang.blaze3d.platform.InputConstants;
17
18
public class FreeLook extends Module {
19
    private final SettingGroup sgGeneral = settings.getDefaultGroup();
20
    private final SettingGroup sgArrows = settings.createGroup("Arrows");
21
22
    // General
23
24
    public final Setting<Mode> mode = sgGeneral.add(new EnumSetting.Builder<Mode>()
25
        .name("mode")
26
        .description("Which entity to rotate.")
27
        .defaultValue(Mode.Player)
28
        .build()
29
    );
30
31
    public final Setting<Boolean> togglePerspective = sgGeneral.add(new BoolSetting.Builder()
32
        .name("toggle-perspective")
33
        .description("Changes your perspective on toggle.")
34
        .defaultValue(true)
35
        .build()
36
    );
37
38
    public final Setting<Double> sensitivity = sgGeneral.add(new DoubleSetting.Builder()
39
        .name("camera-sensitivity")
40
        .description("How fast the camera moves in camera mode.")
41
        .defaultValue(8)
42
        .min(0)
43
        .sliderMax(10)
44
        .build()
45
    );
46
47
    // Arrows
48
49
    public final Setting<Boolean> arrows = sgArrows.add(new BoolSetting.Builder()
50
        .name("arrows-control-opposite")
51
        .description("Allows you to control the other entities rotation with the arrow keys.")
52
        .defaultValue(true)
53
        .build()
54
    );
55
56
    private final Setting<Double> arrowSpeed = sgArrows.add(new DoubleSetting.Builder()
57
        .name("arrow-speed")
58
        .description("Rotation speed with arrow keys.")
59
        .defaultValue(4)
60
        .min(0)
61
        .build()
62
    );
63
64
    public float cameraYaw;
65
    public float cameraPitch;
66
67
    private CameraType prePers;
68
69
    public FreeLook() {
70
        super(Categories.Render, "free-look", "Allows more rotation options in third person.");
71
    }
72
73
    @Override
74
    public void onActivate() {
75
        cameraYaw = mc.player.getYRot();
76
        cameraPitch = mc.player.getXRot();
77
        prePers = mc.options.getCameraType();
78
79
        if (prePers != CameraType.THIRD_PERSON_BACK && togglePerspective.get())
80
            mc.options.setCameraType(CameraType.THIRD_PERSON_BACK);
81
    }
82
83
    @Override
84
    public void onDeactivate() {
85
        if (prePers != null && mc.options.getCameraType() != prePers && togglePerspective.get()) mc.options.setCameraType(prePers);
86
    }
87
88
    public boolean playerMode() {
89
        return isActive() && mc.options.getCameraType() == CameraType.THIRD_PERSON_BACK && mode.get() == Mode.Player;
90
    }
91
92
    public boolean cameraMode() {
93
        return isActive() && mode.get() == Mode.Camera;
94
    }
95
96
    @EventHandler
97
    private void onTick(TickEvent.Post event) {
98
        if (arrows.get()) {
99
            for (int i = 0; i < (arrowSpeed.get() * 2); i++) {
100
                switch (mode.get()) {
101
                    case Player -> {
102
                        if (Input.isKeyPressed(InputConstants.KEY_LEFT)) cameraYaw -= 0.5;
103
                        if (Input.isKeyPressed(InputConstants.KEY_RIGHT)) cameraYaw += 0.5;
104
                        if (Input.isKeyPressed(InputConstants.KEY_UP)) cameraPitch -= 0.5;
105
                        if (Input.isKeyPressed(InputConstants.KEY_DOWN)) cameraPitch += 0.5;
106
                    }
107
                    case Camera -> {
108
                        float yaw = mc.player.getYRot();
109
                        float pitch = mc.player.getXRot();
110
111
                        if (Input.isKeyPressed(InputConstants.KEY_LEFT)) yaw -= 0.5;
112
                        if (Input.isKeyPressed(InputConstants.KEY_RIGHT)) yaw += 0.5;
113
                        if (Input.isKeyPressed(InputConstants.KEY_UP)) pitch -= 0.5;
114
                        if (Input.isKeyPressed(InputConstants.KEY_DOWN)) pitch += 0.5;
115
116
                        mc.player.setYRot(yaw);
117
                        mc.player.setXRot(pitch);
118
                    }
119
                }
120
            }
121
        }
122
123
        mc.player.setXRot(Mth.clamp(mc.player.getXRot(), -90, 90));
124
        cameraPitch = Mth.clamp(cameraPitch, -90, 90);
125
    }
126
127
    public enum Mode {
128
        Player,
129
        Camera
130
    }
131
}
132