SafeWalk module

SafeWalk: Minecraft 26.3 cheat module, full source for every implementation (4 clients: MelaHack (ThunderHack fork), Combatant, KiwiClient, …).

4 implementationsMOVEMENT

Full module source: 4 implementations

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

MelaHack (ThunderHack fork)MOVEMENTsrc/main/java/thunder/hack/features/modules/movement/SafeWalk.javaJava · 10 lines · 212 B

Sneaks on edge of block.

SafeWalk.javaJava · Minecraft 26.2 · 10 lines · 212 B · complete file, verbatimOriginal ↗
1
package thunder.hack.features.modules.movement;
2
3
import thunder.hack.features.modules.Module;
4
5
public class SafeWalk extends Module {
6
    public SafeWalk() {
7
        super("SafeWalk", Category.MOVEMENT);
8
    }
9
}
10
CombatantMOVEMENTsrc/main/java/combatant/client/features/module/modules/movement/SafeWalk.javaJava · 130 lines · 3.9 KB
Settingsmodeon_edge_modeedge_distancekeep_tickssneak_ticksjump
SafeWalk.javaJava · Minecraft 26.2 · 130 lines · 3.9 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of the Combatant Client distribution.
3
 * Copyright (c) 2026 pivosos2007.
4
 *
5
 * Licensed under the GNU General Public License v3.0.
6
 */
7
8
package combatant.client.features.module.modules.movement;
9
10
import lombok.RequiredArgsConstructor;
11
import net.minecraft.client.Minecraft;
12
import net.minecraft.client.player.LocalPlayer;
13
import combatant.client.config.values.BooleanValue;
14
import combatant.client.config.values.EnumValue;
15
import combatant.client.config.values.NumberValue;
16
import combatant.client.events.EventHandler;
17
import combatant.client.events.impl.MovementInputEvent;
18
import combatant.client.events.impl.PlayerSafeWalkEvent;
19
import combatant.client.features.module.Module;
20
import combatant.client.features.module.ModuleCategory;
21
import combatant.client.features.module.ModuleInfo;
22
import combatant.client.util.entity.EagleUtil;
23
24
//todo Description
25
@ModuleInfo(
26
        id = "safewalk",
27
        displayName = "SafeWalk",
28
        category = ModuleCategory.MOVEMENT
29
)
30
public final class SafeWalk extends Module {
31
32
    private final Minecraft mc = Minecraft.getInstance();
33
    private final EnumValue<Mode> mode = enumMode("mode", Mode.ON_EDGE);
34
    private final EnumValue<OnEdgeMode> onEdgeMode =
35
            visibleWhen(enumMode("on_edge_mode", OnEdgeMode.STOP), this::isOnEdgeMode);
36
    private final NumberValue<Double> edgeDistance =
37
            visibleWhen(num("edge_distance", 0.1, 0.01, 0.5), this::isOnEdgeMode);
38
    private final NumberValue<Integer> keepTicks =
39
            visibleWhen(num("keep_ticks", 2, 1, 20), this::isOnEdgeMode);
40
    private final NumberValue<Integer> sneakTicks =
41
            visibleWhen(num("sneak_ticks", 0, 0, 20), this::isOnEdgeMode);
42
    private final BooleanValue jump =
43
            visibleWhen(bool("jump", false), this::isOnEdgeMode);
44
    private final EagleUtil.EdgeRecovery edgeRecovery = new EagleUtil.EdgeRecovery();
45
46
    private boolean isOnEdgeMode() {
47
        return mode.get() == Mode.ON_EDGE;
48
    }
49
50
    @Override
51
    public void onDisable() {
52
        edgeRecovery.reset();
53
    }
54
55
    public boolean handleExternalOnEdge(LocalPlayer player, MovementInputEvent event) {
56
        if (player == null || event == null || player.getAbilities().flying) {
57
            edgeRecovery.reset();
58
            return false;
59
        }
60
61
        if (!player.onGround() && !event.isSneak()) {
62
            edgeRecovery.reset();
63
            return false;
64
        }
65
66
        return edgeRecovery.handleOnEdge(
67
                player,
68
                event,
69
                edgeDistance.get(),
70
                onEdgeMode.get().recoveryMode(),
71
                keepTicks.get(),
72
                sneakTicks.get(),
73
                jump.get()
74
        );
75
    }
76
77
    @EventHandler
78
    private void onSafeWalk(PlayerSafeWalkEvent event) {
79
        if (!isEnabled() || mode.get() != Mode.SAFE) {
80
            return;
81
        }
82
83
        LocalPlayer player = mc.player;
84
        if (player == null || !player.onGround() || player.getAbilities().flying) {
85
            return;
86
        }
87
88
        event.setSafeWalk(true);
89
    }
90
91
    @EventHandler
92
    private void onMovementInput(MovementInputEvent event) {
93
        if (!isEnabled() || mode.get() != Mode.ON_EDGE) {
94
            edgeRecovery.reset();
95
            return;
96
        }
97
98
        LocalPlayer player = mc.player;
99
        if (player == null || player.getAbilities().flying) {
100
            edgeRecovery.reset();
101
            return;
102
        }
103
104
        if (!player.onGround() && !event.isSneak()) {
105
            edgeRecovery.reset();
106
            return;
107
        }
108
109
        handleExternalOnEdge(player, event);
110
    }
111
112
    public enum Mode {
113
        SAFE,
114
        ON_EDGE
115
    }
116
117
    @RequiredArgsConstructor
118
    public enum OnEdgeMode {
119
        STOP(EagleUtil.RecoveryMode.STOP),
120
        INVERT(EagleUtil.RecoveryMode.INVERT),
121
        CENTER(EagleUtil.RecoveryMode.CENTER);
122
123
        private final EagleUtil.RecoveryMode recoveryMode;
124
125
        public EagleUtil.RecoveryMode recoveryMode() {
126
            return recoveryMode;
127
        }
128
    }
129
}
130
KiwiClientMOVEMENTsrc/main/java/com/tangykiwi/kiwiclient/module/movement/SafeWalk.javaJava · 15 lines · 474 B

Prevents you from falling off edges

SettingsSneak
SafeWalk.javaJava · Minecraft 26.2 · 15 lines · 474 B · complete file, verbatimOriginal ↗
1
package com.tangykiwi.kiwiclient.module.movement;
2
3
import com.tangykiwi.kiwiclient.module.Category;
4
import com.tangykiwi.kiwiclient.module.Module;
5
import com.tangykiwi.kiwiclient.module.setting.ToggleSetting;
6
7
public class SafeWalk extends Module {
8
    public SafeWalk() {
9
        super("SafeWalk", "Prevents you from falling off edges", Category.MOVEMENT,
10
            new ToggleSetting("Sneak", "Sneak when near edges", true));
11
    }
12
13
    // handling done in PlayerMixin
14
}
15
LiquidBounce (Kotlin)MOVEMENTsrc/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/movement/ModuleSafeWalk.ktKotlin · 197 lines · 7.7 KB

Prevents you from falling down block (as if you were sneaking).

SettingsKeepModeSneakJump
ModuleSafeWalk.ktKotlin · Minecraft 26.2 · 197 lines · 7.7 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.movement
20
21
import net.ccbluex.liquidbounce.config.types.group.Mode
22
import net.ccbluex.liquidbounce.config.types.group.ModeValueGroup
23
import net.ccbluex.liquidbounce.config.types.group.NoneMode
24
import net.ccbluex.liquidbounce.config.types.list.Tagged
25
import net.ccbluex.liquidbounce.config.utils.asRefreshable
26
import net.ccbluex.liquidbounce.event.events.MovementInputEvent
27
import net.ccbluex.liquidbounce.event.events.PlayerSafeWalkEvent
28
import net.ccbluex.liquidbounce.event.handler
29
import net.ccbluex.liquidbounce.features.module.ClientModule
30
import net.ccbluex.liquidbounce.features.module.ModuleCategories
31
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleDebug
32
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleDebug.debugGeometry
33
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleDebug.debugParameter
34
import net.ccbluex.liquidbounce.render.engine.type.Color4b
35
import net.ccbluex.liquidbounce.utils.entity.PlayerSimulationCache
36
import net.ccbluex.liquidbounce.utils.entity.horizontalSpeed
37
import net.ccbluex.liquidbounce.utils.entity.isCloseToEdge
38
import net.ccbluex.liquidbounce.utils.entity.wouldBeCloseToFallOff
39
import net.ccbluex.liquidbounce.utils.kotlin.EventPriorityConvention
40
import net.ccbluex.liquidbounce.utils.math.bottomCenter
41
import net.ccbluex.liquidbounce.utils.movement.DirectionalInput
42
import net.ccbluex.liquidbounce.utils.movement.getDegreesRelativeToView
43
import net.ccbluex.liquidbounce.utils.movement.getDirectionalInputForDegrees
44
import net.minecraft.world.phys.Vec3
45
import kotlin.math.min
46
47
/**
48
 * SafeWalk module
49
 *
50
 * Prevents you from falling down as if you were sneaking.
51
 */
52
object ModuleSafeWalk : ClientModule("SafeWalk", ModuleCategories.MOVEMENT) {
53
54
    @Suppress("UnusedPrivateProperty")
55
    private val modes = choices("Mode", 1, ::safeWalkChoices) // Default safe mode
56
57
    fun safeWalkChoices(mode: ModeValueGroup<Mode>): Array<Mode> {
58
        return arrayOf(
59
            NoneMode(mode),
60
            Safe(mode),
61
            OnEdge(mode)
62
        )
63
    }
64
65
    private class Safe(override val parent: ModeValueGroup<Mode>) : Mode("Safe") {
66
67
        @Suppress("unused")
68
        val safeWalkHandler = handler<PlayerSafeWalkEvent> { event ->
69
            event.isSafeWalk = true
70
        }
71
72
    }
73
74
    private class OnEdge(override val parent: ModeValueGroup<Mode>) : Mode("OnEdge") {
75
76
        private val edgeDistance = floatRange("Distance", 0.1f..0.15f, 0.05f..0.5f).asRefreshable()
77
        private var center: Vec3? = null
78
79
        private enum class OnEdgeMode(override val tag: String) : Tagged {
80
            STOP("Stop"),
81
            INVERT("Invert"),
82
            CENTER("Center"),
83
        }
84
85
        /**
86
         * Defines how many ticks we should keep running the [mode]
87
         */
88
        private val keepTicks by intRange("Keep", 1..2, 1..20, suffix = "ticks")
89
        private var overwriteTicks = 0
90
91
        private val mode by enumChoice("Mode", OnEdgeMode.STOP)
92
        private val sneak by intRange("Sneak", 0..0, 0..20, suffix = "ticks")
93
        private var sneakTicks = 0
94
        private val jump by boolean("Jump", false)
95
96
        /**
97
         * The input handler tracks the movement of the player and calculates the predicted future position.
98
         */
99
        @Suppress("unused")
100
        val inputHandler = handler<MovementInputEvent>(
101
            priority = EventPriorityConvention.OBJECTION_AGAINST_EVERYTHING
102
        ) { event ->
103
            val shouldBeActive = player.onGround() && !event.sneak
104
            if (shouldBeActive) {
105
                val isOnEdge = player.isCloseToEdge(
106
                    event.directionalInput,
107
                    min(player.horizontalSpeed, edgeDistance.current.toDouble())
108
                )
109
                if (isOnEdge) {
110
                    debugParameter("InputOnEdge") { event.directionalInput }
111
112
                    val center = center
113
                    if (center != null) {
114
                        val nextTick = PlayerSimulationCache.getSimulationForLocalPlayer().getSnapshotAt(1)
115
                        debugGeometry("Center") {
116
                            ModuleDebug.DebuggedPoint(center, Color4b.BLUE, 0.05)
117
                        }
118
119
                        val currentDistance = center.subtract(player.position()).horizontalDistanceSqr()
120
                        val nextDistance = center.subtract(nextTick.pos).horizontalDistanceSqr()
121
122
                        debugParameter("CurrentDistance") { currentDistance }
123
                        debugParameter("NextDistance") { nextDistance }
124
125
                        if (nextDistance <= currentDistance) {
126
                            return@handler
127
                        }
128
                    }
129
130
                    if (overwriteTicks == 0) {
131
                        edgeDistance.refresh()
132
                        overwriteTicks = keepTicks.random()
133
                    }
134
135
                    if (sneakTicks == 0) {
136
                        sneakTicks = sneak.random()
137
                    }
138
                }
139
            }
140
141
            if (overwriteTicks > 0) {
142
                debugParameter("OverwriteInputTicks") { overwriteTicks }
143
                overwriteTicks--
144
145
                when {
146
                    mode == OnEdgeMode.INVERT -> {
147
                        event.directionalInput = event.directionalInput.invert()
148
                        event.jump = false
149
                    }
150
                    (mode == OnEdgeMode.CENTER || player.horizontalSpeed > 0.05) -> {
151
                        val center = center ?: player.blockPosition().bottomCenter
152
                        val degrees = getDegreesRelativeToView(
153
                            center.subtract(player.position()),
154
                            player.yRot
155
                        )
156
                        event.directionalInput = getDirectionalInputForDegrees(
157
                            DirectionalInput.NONE,
158
                            degrees, deadAngle = 20.0F
159
                        )
160
                    }
161
                    // [STOP] and [SNEAK] mode is not powerful enough to prevent falling off
162
                    // so we use [CENTER] to fix speed when the player is moving too fast
163
                    mode == OnEdgeMode.STOP -> {
164
                        event.directionalInput = DirectionalInput.NONE
165
                        event.jump = false
166
                    }
167
                }
168
169
                // Can do cool tricks with jumping
170
                if (jump) {
171
                    event.jump = true
172
                }
173
            }
174
175
            if (sneakTicks > 0) {
176
                sneakTicks--
177
                event.sneak = true
178
            }
179
180
            // Find last good position to stand on
181
            val blockPos = player.blockPosition().bottomCenter
182
            if (!player.wouldBeCloseToFallOff(blockPos)) {
183
                center = blockPos
184
            }
185
        }
186
187
        override fun disable() {
188
            center = null
189
            overwriteTicks = 0
190
            edgeDistance.refresh()
191
            super.disable()
192
        }
193
194
    }
195
196
}
197