Derp module

Derp: Minecraft 26.3 cheat module, full source for every implementation (2 clients: OfflineClient, LiquidBounce (Kotlin)).

2 implementationsMISCFUN

Full module source: 2 implementations

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

OfflineClientMISCsrc/main/java/com/jellypudding/offlineclient/modules/misc/Derp.javaJava · 184 lines · 6.5 KB

Makes you look ridiculous to everyone else.

SettingsModeSpeedTwerk speedPause in combat
Derp.javaJava · Minecraft 26.2 · 184 lines · 6.5 KB · complete file, verbatimOriginal ↗
1
package com.jellypudding.offlineclient.modules.misc;
2
3
import com.jellypudding.offlineclient.event.Subscribe;
4
import com.jellypudding.offlineclient.event.events.PreMotionEvent;
5
import com.jellypudding.offlineclient.module.Category;
6
import com.jellypudding.offlineclient.module.Module;
7
import com.jellypudding.offlineclient.modules.combat.CrystalAura;
8
import com.jellypudding.offlineclient.setting.BoolSetting;
9
import com.jellypudding.offlineclient.setting.EnumSetting;
10
import com.jellypudding.offlineclient.setting.NumberSetting;
11
import com.jellypudding.offlineclient.util.InputUtil;
12
import com.jellypudding.offlineclient.util.Modules;
13
import com.jellypudding.offlineclient.util.RotationManager;
14
import com.jellypudding.offlineclient.util.RotationPriority;
15
import net.minecraft.network.protocol.game.ServerboundSwingPacket;
16
import net.minecraft.util.Mth;
17
import net.minecraft.world.InteractionHand;
18
19
import java.util.concurrent.ThreadLocalRandom;
20
21
// Sends silly rotations and swings and crouches to the server whilst the local view is left alone.
22
public final class Derp extends Module {
23
24
    public enum Mode { SPIN, SHAKE, HEADBANG, FLAIL, TWERK, RANDOM }
25
26
    // Ticks a full crouch and stand takes at the slowest twerk speed. At the
27
    // fastest it flips every tick which is as quick as the server will show.
28
    private static final int TWERK_SLOWEST = 11;
29
    private static final int TWERK_FASTEST = 10;
30
31
    // Ticks between arm swings whilst flailing. A swing takes about six to play out.
32
    private static final int FLAIL_GAP = 3;
33
34
    private final EnumSetting<Mode> mode = new EnumSetting<>("Mode",
35
        "How you look to everyone else.", Mode.SPIN)
36
        .describe(Mode.SPIN, "Turns your head round and round.")
37
        .describe(Mode.SHAKE, "Shakes your head from side to side.")
38
        .describe(Mode.HEADBANG, "Nods your head up and down.")
39
        .describe(Mode.FLAIL, "Waves both arms about.")
40
        .describe(Mode.TWERK, "Crouches up and down on the spot.")
41
        .describe(Mode.RANDOM, "Points your head somewhere new every tick and flails now and then.");
42
    private final NumberSetting speed = new NumberSetting("Speed",
43
        "How far the head moves each tick.", 30, 1, 90, 1, " degrees").min(1).max(180)
44
        .under(mode, Mode.SPIN, Mode.SHAKE, Mode.HEADBANG);
45
    private final NumberSetting twerkSpeed = new NumberSetting("Twerk speed",
46
        "How fast you crouch and stand. Ten flips every tick which is as fast as it gets.",
47
        5, 1, TWERK_FASTEST, 1).min(1).max(TWERK_FASTEST)
48
        .under(mode, Mode.TWERK);
49
    private final BoolSetting pauseInCombat = new BoolSetting("Pause in combat",
50
        "Stops whilst your hands are busy or CrystalAura has a target.", true);
51
52
    private float yaw;
53
    private float pitch;
54
    private boolean rising = true;
55
    private boolean left;
56
    private int flailTimer;
57
    private int twerkTimer;
58
    private boolean crouched;
59
60
    public Derp() {
61
        super("Derp", "Makes you look ridiculous to everyone else.", Category.MISC);
62
        addSettings(mode, speed, twerkSpeed, pauseInCombat);
63
        searchTags("derp", "silly", "troll", "spin", "flail");
64
    }
65
66
    @Override
67
    public String getSuffix() {
68
        return mode.getValueString();
69
    }
70
71
    @Override
72
    protected void onDisable() {
73
        standUp();
74
    }
75
76
    @Override
77
    protected void onEnable() {
78
        flailTimer = 0;
79
        twerkTimer = 0;
80
        if (inGame()) {
81
            yaw = mc.player.getYRot();
82
            pitch = mc.player.getXRot();
83
        }
84
    }
85
86
    @Subscribe
87
    private void onPreMotion(PreMotionEvent event) {
88
        if (!inGame() || mc.player.isSpectator()) {
89
            return;
90
        }
91
        if (pauseInCombat.isOn() && aimingModuleActive()) {
92
            return;
93
        }
94
        if (flailTimer > 0) {
95
            flailTimer--;
96
        }
97
        if (!mode.is(Mode.TWERK)) {
98
            standUp();
99
        }
100
101
        float step = speed.getFloat();
102
        switch (mode.getValue()) {
103
            case SPIN -> {
104
                yaw += step;
105
                pitch = 0;
106
            }
107
            case SHAKE -> {
108
                // Alternates either side of where the player really looks.
109
                left = !left;
110
                yaw = mc.player.getYRot() + (left ? step : -step);
111
                pitch = mc.player.getXRot();
112
            }
113
            case HEADBANG -> {
114
                yaw = mc.player.getYRot();
115
                pitch += rising ? step : -step;
116
                if (pitch >= 90) {
117
                    rising = false;
118
                } else if (pitch <= -90) {
119
                    rising = true;
120
                }
121
            }
122
            case FLAIL -> {
123
                flail();
124
                return;
125
            }
126
            case TWERK -> {
127
                twerk();
128
                return;
129
            }
130
            case RANDOM -> {
131
                yaw = ThreadLocalRandom.current().nextFloat(-180f, 180f);
132
                pitch = ThreadLocalRandom.current().nextFloat(-90f, 90f);
133
                if (ThreadLocalRandom.current().nextInt(4) == 0) {
134
                    flail();
135
                }
136
            }
137
        }
138
        yaw = Mth.wrapDegrees(yaw);
139
        pitch = Math.clamp(pitch, -90f, 90f);
140
141
        RotationManager.requestExact(yaw, pitch, RotationPriority.IDLE);
142
    }
143
144
    // Only the server is told about the crouch. Your own view and speed stay as they are.
145
    private void twerk() {
146
        if (twerkTimer > 0) {
147
            twerkTimer--;
148
            return;
149
        }
150
        twerkTimer = TWERK_SLOWEST - twerkSpeed.getInt();
151
        crouched = !crouched;
152
        InputUtil.sendShift(crouched);
153
    }
154
155
    // Puts the server back on the real key state.
156
    private void standUp() {
157
        if (crouched && mc.player != null) {
158
            InputUtil.sendShift(mc.player.getLastSentInput().shift());
159
        }
160
        crouched = false;
161
    }
162
163
    // Swings the arms in turn. Only the packet goes out.
164
    // The server plays the animation but never echoes it back. The view stays still.
165
    private void flail() {
166
        if (flailTimer > 0) {
167
            return;
168
        }
169
        flailTimer = FLAIL_GAP;
170
        left = !left;
171
        mc.player.connection.send(new ServerboundSwingPacket(
172
            left ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND));
173
    }
174
175
    private boolean aimingModuleActive() {
176
        if (mc.player.swinging && !mode.is(Mode.FLAIL) && !mode.is(Mode.RANDOM)
177
            || mc.options.keyAttack.isDown() || mc.player.isUsingItem()) {
178
            return true;
179
        }
180
        CrystalAura crystalAura = Modules.active(CrystalAura.class);
181
        return crystalAura != null && crystalAura.hasTarget();
182
    }
183
}
184
LiquidBounce (Kotlin)FUNsrc/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/fun/ModuleDerp.ktKotlin · 173 lines · 5.1 KB

Makes it look as if you were derping around to other players

SettingsSafePitchNotDuringSprintYawOffsetForwardTicksBackwardTicksSpeedPitch
ModuleDerp.ktKotlin · Minecraft 26.2 · 173 lines · 5.1 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
3
 *
4
 * Copyright (c) 2015 - 2026 CCBlueX
5
 *
6
 * LiquidBounce is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * LiquidBounce is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
18
 */
19
package net.ccbluex.liquidbounce.features.module.modules.`fun`
20
21
import net.ccbluex.liquidbounce.config.types.group.Mode
22
import net.ccbluex.liquidbounce.config.types.group.ModeValueGroup
23
import net.ccbluex.liquidbounce.event.events.GameTickEvent
24
import net.ccbluex.liquidbounce.event.handler
25
import net.ccbluex.liquidbounce.event.tickHandler
26
import net.ccbluex.liquidbounce.event.waitTicks
27
import net.ccbluex.liquidbounce.features.module.ClientModule
28
import net.ccbluex.liquidbounce.features.module.ModuleCategories
29
import net.ccbluex.liquidbounce.utils.aiming.RotationManager
30
import net.ccbluex.liquidbounce.utils.aiming.RotationsValueGroup
31
import net.ccbluex.liquidbounce.utils.aiming.data.Rotation
32
import net.ccbluex.liquidbounce.utils.kotlin.Priority
33
import net.ccbluex.liquidbounce.utils.kotlin.random
34
35
/**
36
 * Derp module
37
 *
38
 * Makes it look as if you were derping around.
39
 */
40
object ModuleDerp : ClientModule("Derp", ModuleCategories.FUN) {
41
42
    private val yawMode = choices("Yaw", YawRandom,
43
        arrayOf(YawStatic, YawOffset, YawRandom, YawJitter, YawSpin))
44
    private val pitchMode = choices("Pitch", PitchRandom,
45
        arrayOf(PitchStatic, PitchOffset, PitchRandom))
46
    private val safePitch by boolean("SafePitch", true)
47
    private val notDuringSprint by boolean("NotDuringSprint", true)
48
49
    // DO NOT USE TREE TO MAKE SURE THAT THE ROTATIONS ARE NOT CHANGED
50
    private val rotations = RotationsValueGroup(this)
51
52
    private val tickHandler = handler<GameTickEvent> {
53
        if (notDuringSprint && (mc.options.keySprint.isDown || player.isSprinting)) {
54
            return@handler
55
        }
56
57
        val yaw = yawMode.activeMode.yaw
58
        val pitch = pitchMode.activeMode.pitch.let {
59
            if (safePitch) {
60
                it.coerceIn(-90f, 90f)
61
            } else {
62
                it
63
            }
64
        }
65
66
        RotationManager.setRotationTarget(rotations.toRotationTarget(Rotation(yaw, pitch)),
67
            Priority.NOT_IMPORTANT, this@ModuleDerp)
68
    }
69
70
    private object YawStatic : YawMode("Static") {
71
72
        val yawValue by float("Yaw", 0f, -180f..180f, "°")
73
74
        override val yaw: Float
75
            get() = yawValue
76
77
    }
78
79
    private object YawOffset : YawMode("Offset") {
80
81
        val yawOffsetValue by float("Offset", 0f, -180f..180f, "°")
82
83
        override val yaw: Float
84
            get() = player.yRot + yawOffsetValue
85
86
    }
87
88
    private object YawRandom : YawMode("Random") {
89
        override val yaw: Float
90
            get() = (-180f..180f).random()
91
92
    }
93
94
    private object YawJitter : YawMode("Jitter") {
95
96
        override var yaw = 0.0f
97
98
        val yawForwardTicks by int("ForwardTicks", 2, 0..100, "ticks")
99
        val yawBackwardTicks by int("BackwardTicks", 2, 0..100, "ticks")
100
101
        @Suppress("unused")
102
        val repeatable = tickHandler {
103
            repeat(yawForwardTicks) {
104
                yaw = player.yRot
105
                waitTicks(1)
106
            }
107
108
            repeat(yawBackwardTicks) {
109
                yaw = player.yRot + 180
110
                waitTicks(1)
111
            }
112
        }
113
114
    }
115
116
    private object YawSpin : YawMode("Spin") {
117
118
        override var yaw = 0.0f
119
120
        val yawSpinSpeed by int("Speed", 50, -70..70, "°/tick")
121
122
        @Suppress("unused")
123
        val repeatable = tickHandler {
124
            yaw += yawSpinSpeed
125
            waitTicks(1)
126
        }
127
128
    }
129
130
    private object PitchStatic : PitchMode("Static") {
131
132
        override val pitch: Float
133
            get() = pitchValue
134
135
        val pitchValue by float("Pitch", -90f, -180f..180f, "°")
136
137
    }
138
139
    private object PitchOffset : PitchMode("Offset") {
140
141
        override val pitch: Float
142
            get() = player.xRot + pitchOffsetValue
143
144
        val pitchOffsetValue by float("Offset", 0f, -180f..180f, "°")
145
146
    }
147
148
    private object PitchRandom : PitchMode("Random") {
149
150
        override val parent: ModeValueGroup<*>
151
            get() = pitchMode
152
153
        override val pitch: Float
154
            get() = if (safePitch) (-90f..90f).random() else (-180f..180f).random()
155
156
    }
157
158
    private sealed class YawMode(name: String) : Mode(name) {
159
        override val parent: ModeValueGroup<*>
160
            get() = yawMode
161
        abstract val yaw: Float
162
    }
163
164
    private sealed class PitchMode(name: String) : Mode(name) {
165
        override val parent: ModeValueGroup<*>
166
            get() = pitchMode
167
        abstract val pitch: Float
168
    }
169
170
171
172
}
173