rotation module

rotation: Minecraft 26.3 cheat module, full source for every implementation (2 clients: Meteor Client, OfflineClient).

2 implementationsPlayerPLAYER

Clients with this module

Full module source: 2 implementations

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

Meteor ClientPlayersrc/main/java/meteordevelopment/meteorclient/systems/modules/player/Rotation.javaJava · 101 lines · 3.1 KB

Changes/locks your yaw and pitch.

Settingsyaw-lock-modeyaw-anglepitch-lock-modepitch-angle
Rotation.javaJava · Minecraft 26.2 · 101 lines · 3.1 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.player;
7
8
import meteordevelopment.meteorclient.events.world.TickEvent;
9
import meteordevelopment.meteorclient.settings.DoubleSetting;
10
import meteordevelopment.meteorclient.settings.EnumSetting;
11
import meteordevelopment.meteorclient.settings.Setting;
12
import meteordevelopment.meteorclient.settings.SettingGroup;
13
import meteordevelopment.meteorclient.systems.modules.Categories;
14
import meteordevelopment.meteorclient.systems.modules.Module;
15
import meteordevelopment.orbit.EventHandler;
16
17
public class Rotation extends Module {
18
    private final SettingGroup sgYaw = settings.createGroup("Yaw");
19
    private final SettingGroup sgPitch = settings.createGroup("Pitch");
20
21
    // Yaw
22
23
    private final Setting<LockMode> yawLockMode = sgYaw.add(new EnumSetting.Builder<LockMode>()
24
        .name("yaw-lock-mode")
25
        .description("The way in which your yaw is locked.")
26
        .defaultValue(LockMode.Simple)
27
        .build()
28
    );
29
30
    private final Setting<Double> yawAngle = sgYaw.add(new DoubleSetting.Builder()
31
        .name("yaw-angle")
32
        .description("Yaw angle in degrees.")
33
        .defaultValue(0)
34
        .sliderMax(360)
35
        .max(360)
36
        .visible(() -> yawLockMode.get() == LockMode.Simple)
37
        .build()
38
    );
39
40
    // Pitch
41
42
    private final Setting<LockMode> pitchLockMode = sgPitch.add(new EnumSetting.Builder<LockMode>()
43
        .name("pitch-lock-mode")
44
        .description("The way in which your pitch is locked.")
45
        .defaultValue(LockMode.Simple)
46
        .build()
47
    );
48
49
    private final Setting<Double> pitchAngle = sgPitch.add(new DoubleSetting.Builder()
50
        .name("pitch-angle")
51
        .description("Pitch angle in degrees.")
52
        .defaultValue(0)
53
        .range(-90, 90)
54
        .sliderRange(-90, 90)
55
        .visible(() -> pitchLockMode.get() == LockMode.Simple)
56
        .build()
57
    );
58
59
    public Rotation() {
60
        super(Categories.Player, "rotation", "Changes/locks your yaw and pitch.");
61
    }
62
63
    @Override
64
    public void onActivate() {
65
        onTick(null);
66
    }
67
68
    @EventHandler
69
    private void onTick(TickEvent.Post event) {
70
        switch (yawLockMode.get()) {
71
            case Simple -> setYawAngle(yawAngle.get().floatValue());
72
            case Smart -> setYawAngle(getSmartYawDirection());
73
        }
74
75
        switch (pitchLockMode.get()) {
76
            case Simple -> mc.player.setXRot(pitchAngle.get().floatValue());
77
            case Smart -> mc.player.setXRot(getSmartPitchDirection());
78
        }
79
    }
80
81
    private float getSmartYawDirection() {
82
        return Math.round((mc.player.getYRot() + 1f) / 45f) * 45f;
83
    }
84
85
    private float getSmartPitchDirection() {
86
        return Math.round((mc.player.getXRot() + 1f) / 30f) * 30f;
87
    }
88
89
    private void setYawAngle(float yawAngle) {
90
        mc.player.setYRot(yawAngle);
91
        mc.player.yHeadRot = yawAngle;
92
        mc.player.yBodyRot = yawAngle;
93
    }
94
95
    public enum LockMode {
96
        Smart,
97
        Simple,
98
        None
99
    }
100
}
101
OfflineClientPLAYERsrc/main/java/com/jellypudding/offlineclient/modules/player/Rotation.javaJava · 77 lines · 2.8 KB

Locks your view to a chosen angle.

SettingsYawYaw anglePitchPitch angle
Rotation.javaJava · Minecraft 26.2 · 77 lines · 2.8 KB · complete file, verbatimOriginal ↗
1
package com.jellypudding.offlineclient.modules.player;
2
3
import com.jellypudding.offlineclient.event.Subscribe;
4
import com.jellypudding.offlineclient.event.events.TickEvent;
5
import com.jellypudding.offlineclient.module.Category;
6
import com.jellypudding.offlineclient.module.Module;
7
import com.jellypudding.offlineclient.setting.EnumSetting;
8
import com.jellypudding.offlineclient.setting.NumberSetting;
9
10
// Holds the view at a fixed angle. Snap rounds it to the nearest clean heading instead.
11
public final class Rotation extends Module {
12
13
    public enum Lock { OFF, FIXED, SNAP }
14
15
    private static final float YAW_SNAP = 45;
16
    private static final float PITCH_SNAP = 30;
17
18
    private final EnumSetting<Lock> yawLock = new EnumSetting<>("Yaw",
19
        "How the yaw is held.", Lock.FIXED)
20
        .describe(Lock.OFF, "The yaw is left alone.")
21
        .describe(Lock.FIXED, "Holds the yaw at the angle below.")
22
        .describe(Lock.SNAP, "Rounds the yaw to the nearest 45 degrees.");
23
    private final NumberSetting yaw = new NumberSetting("Yaw angle",
24
        "Degrees to hold the yaw at.", 0, -180, 180, 5, "°")
25
        .under(yawLock, Lock.FIXED);
26
    private final EnumSetting<Lock> pitchLock = new EnumSetting<>("Pitch",
27
        "How the pitch is held.", Lock.FIXED)
28
        .describe(Lock.OFF, "The pitch is left alone.")
29
        .describe(Lock.FIXED, "Holds the pitch at the angle below.")
30
        .describe(Lock.SNAP, "Rounds the pitch to the nearest 30 degrees.");
31
    private final NumberSetting pitch = new NumberSetting("Pitch angle",
32
        "Degrees to hold the pitch at. Down is positive.", 0, -90, 90, 5, "°")
33
        .under(pitchLock, Lock.FIXED);
34
35
    public Rotation() {
36
        super("Rotation", "Locks your view to a chosen angle.", Category.PLAYER);
37
        addSettings(yawLock, yaw, pitchLock, pitch);
38
        searchTags("yaw lock", "pitch lock", "look lock");
39
    }
40
41
    @Override
42
    protected void onEnable() {
43
        apply();
44
    }
45
46
    @Subscribe
47
    private void onTick(TickEvent event) {
48
        apply();
49
    }
50
51
    private void apply() {
52
        if (!inGame()) {
53
            return;
54
        }
55
        switch (yawLock.getValue()) {
56
            case FIXED -> setYaw(yaw.getFloat());
57
            case SNAP -> setYaw(snap(mc.player.getYRot(), YAW_SNAP));
58
            case OFF -> { }
59
        }
60
        switch (pitchLock.getValue()) {
61
            case FIXED -> mc.player.setXRot(pitch.getFloat());
62
            case SNAP -> mc.player.setXRot(snap(mc.player.getXRot(), PITCH_SNAP));
63
            case OFF -> { }
64
        }
65
    }
66
67
    private void setYaw(float angle) {
68
        mc.player.setYRot(angle);
69
        mc.player.yHeadRot = angle;
70
        mc.player.yBodyRot = angle;
71
    }
72
73
    private static float snap(float angle, float step) {
74
        return Math.round(angle / step) * step;
75
    }
76
}
77