Skip to content
This repository was archived by the owner on Dec 12, 2025. It is now read-only.

Commit 889a6ed

Browse files
authored
Slightly refactor and fix AntiLevitation (#431)
* Improve AntiLevitation * Additional improvements and fixes * 🔨
1 parent 87f26b7 commit 889a6ed

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

src/main/kotlin/com/lambda/client/module/modules/movement/AntiLevitation.kt

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,26 @@ import kotlin.math.sin
1818

1919
object AntiLevitation : Module(
2020
name = "AntiLevitation",
21-
description = "Removes levitation effect (boring) or abuse it (epic)",
21+
description = "Abuses poor anticheat levitation checks",
2222
category = Category.MOVEMENT
2323
) {
2424
private val mode by setting("Mode", Mode.LEGIT, description = "The AntiLevitation mode")
2525

2626
/* Flight mode */
27-
private val vertical by setting("Only Vertical", false, { mode == Mode.FLIGHT }, description = "doesn't apply extra speed when enabled")
28-
private val yMotion by setting("Y Motion", 0.002f, 0.0f..0.02f, 0.001f, { mode == Mode.FLIGHT }, description = "The Y Motion that is applied when moving to bypass the anticheat")
29-
private val speed by setting("Speed", 0.28f, 0.15f..0.3f, 0.005f, { !vertical && mode == Mode.FLIGHT }, description = "The speed you fly at")
30-
private val timer by setting("Timer Boost", true, { !vertical && mode == Mode.FLIGHT }, description = "Use timer for a slight speed boost")
31-
private val timerSpeed by setting("Timer Speed", 1.15f, 1.1f..1.2f, 0.01f, { timer && !vertical && mode == Mode.FLIGHT }, description = "The timer modifier")
27+
private val vertical by setting("No Speed Enhancements", false, { mode == Mode.FLIGHT }, description = "Only influences vertical movement")
28+
private val yMotion by setting("Moving Motion UP", 0.002f, 0.0f..0.02f, 0.001f, { mode == Mode.FLIGHT }, description = "The Y motion that is applied when moving horizontally to bypass the anticheat")
29+
private val sneakMotion by setting("Downward Motion", 0.49f, 0.0f..0.7f, 0.01f, { mode == Mode.FLIGHT }, description = "The downward motion that is applied when pressing sneak")
30+
private val speed by setting("Flying Speed", 0.28f, 0.15f..0.3f, 0.005f, { !vertical && mode == Mode.FLIGHT }, description = "The speed you fly at")
31+
private val timer by setting("Timer Boost", true, { !vertical && mode == Mode.FLIGHT }, description = "Use timer for slightly faster speeds")
32+
private val timerSpeed by setting("Timer Speed", 1.088f, 1.1f..1.2f, 0.01f, { timer && !vertical && mode == Mode.FLIGHT }, description = "The timer modifier")
3233

3334
/* Legit mode */
34-
private val legitYMotion by setting("Motion Up", 0.018f, 0.001f..0.1f, 0.001f, { mode == Mode.LEGIT }, description = "The Y Motion that is applied when moving to bypass the anticheat")
35-
private val boost by setting("Sprint Boost", true, { mode == Mode.LEGIT }, description = "Gives you extra motion when control is pressed")
35+
private val legitYMotion by setting("Legit Constant Motion UP", 0.018f, 0.001f..0.1f, 0.001f, { mode == Mode.LEGIT }, description = "The Y motion that is applied when moving horizontally to bypass the anticheat")
36+
private val boost by setting("Sprint Strafe", true, { mode == Mode.LEGIT }, description = "Removes air friction when holding sprint")
37+
private val legitSneakMotion by setting("Legit Sneak Motion", 0.005f, 0.001f..0.01f, 0.001f, { mode == Mode.LEGIT }, description = "The upward motion that is applied when pressing sneak")
3638

3739
/* Jump motion (used by flight mode and legit mode) */
38-
private val jumpMotion by setting("Jump Motion", 0.099f, 0.090f..0.10f, 0.001f, { mode == Mode.FLIGHT || mode == Mode.LEGIT }, description = "The Y Motion that is applied when you press space")
40+
private val jumpMotion by setting("Jump Motion", 0.099f, 0.090f..0.20f, 0.001f, { mode == Mode.FLIGHT || mode == Mode.LEGIT }, description = "The upward motion that is applied when you press space")
3941

4042
private var ready = false
4143

@@ -78,24 +80,30 @@ object AntiLevitation : Module(
7880
setSpeed(speed.toDouble())
7981
if (timer && !vertical) modifyTimer(50.0f / timerSpeed)
8082
} else {
83+
resetTimer()
8184
player.motionY = 0.0
82-
/* Make the motion slowly become 0, so it flattens out smooth */
83-
player.motionX *= 0.8
84-
player.motionZ *= 0.8
85+
if (!vertical) {
86+
//TODO: figure out how to smooth out velocity equally
87+
player.motionX = 0.0
88+
player.motionZ = 0.0
89+
}
8590
}
8691

8792
if (MovementUtils.isInputting || player.isMoving) {
8893
player.motionY = yMotion.toDouble()
8994
}
9095

9196
if (mc.gameSettings.keyBindJump.isKeyDown) player.motionY = jumpMotion.toDouble()
92-
if (mc.gameSettings.keyBindSneak.isKeyDown) player.motionY = -0.49
97+
if (mc.gameSettings.keyBindSneak.isKeyDown) player.motionY = -sneakMotion.toDouble()
9398
} else if (mode == Mode.LEGIT) {
9499
/* Override vanilla motion with our own motion */
95-
player.motionY = legitYMotion.toDouble()
100+
if (mc.gameSettings.keyBindJump.isKeyDown) {
101+
player.motionY = jumpMotion.toDouble()
102+
} else {
103+
player.motionY = legitYMotion.toDouble()
104+
}
96105

97-
if (mc.gameSettings.keyBindJump.isKeyDown) player.motionY = jumpMotion.toDouble()
98-
if (mc.gameSettings.keyBindSneak.isKeyDown) player.motionY = 0.005
106+
if (mc.gameSettings.keyBindSneak.isKeyDown) player.motionY = legitSneakMotion.toDouble()
99107

100108
if (mc.gameSettings.keyBindSprint.isKeyDown && player.isSprinting && boost) { //player must be sprinting so you can only boost when you press W
101109
val yaw = calcMoveYaw()

0 commit comments

Comments
 (0)