From e6fe73816207b41d290a9eb828262033263eb800 Mon Sep 17 00:00:00 2001 From: pothemagicdragon Date: Wed, 15 Jul 2026 21:30:16 -0600 Subject: [PATCH 1/5] Adds a better auto walk --- .../module/modules/movement/AutoWalk.kt | 63 +++++++++++++++++-- 1 file changed, 57 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt b/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt index 8828eaf9f..43b916ac3 100644 --- a/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt +++ b/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt @@ -17,28 +17,79 @@ package com.lambda.module.modules.movement +import com.lambda.config.Group +import com.lambda.context.SafeContext import com.lambda.event.events.MovementEvent +import com.lambda.event.events.PacketEvent import com.lambda.event.listener.SafeListener.Companion.listen +import com.lambda.interaction.managers.breaking.BreakManager +import com.lambda.interaction.managers.interacting.InteractManager import com.lambda.module.Module import com.lambda.module.tag.ModuleTag +import com.lambda.util.math.MathUtils.toDouble import com.lambda.util.player.MovementUtils.forward +import com.lambda.util.player.MovementUtils.sneaking +import com.lambda.util.player.MovementUtils.sprinting import com.lambda.util.player.MovementUtils.strafe import com.lambda.util.player.MovementUtils.update +import net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket import net.minecraft.util.math.Vec2f @Suppress("unused") object AutoWalk : Module( name = "AutoWalk", - description = "Automatically makes your character walk forward", + description = "Automatically walks in the configured direction when certain conditions are met", tag = ModuleTag.MOVEMENT, ) { - val limitSpeed by setting("Limit Speed", false) - val speed by setting("Speed", 0.5, 0.1..1.0, 0.05) { limitSpeed } + @Group("Movement") private val walkForward by setting("Forward", true, "Automatically walks forward") + @Group("Movement") private val walkBackward by setting("Backward", false, "Automatically walks backward") + @Group("Movement") private val strafeLeft by setting("Strafe Left", false, "Automatically strafes left") + @Group("Movement") private val strafeRight by setting("Strafe Right", false, "Automatically strafes right") + @Group("Movement") private val sneak by setting("Sneak", false, "Automatically sneaks") + @Group("Movement") private val sprint by setting("Sprint", false, "Automatically sprints") + + @Group("Speed") private val limitSpeed by setting("Limit Speed", false) + @Group("Speed") private val speed by setting("Speed", 0.5, 0.1..1.0, 0.05) { limitSpeed } + + @Group("Pausing") private val pauseWhileMining by setting("Pause While Mining", false, "Pauses walking while breaking blocks or when breaks are queued") + @Group("Pausing") private val pauseWhilePlacing by setting("Pause While Placing", false, "Pauses walking while placing blocks or when places are queued - only works with blocks placed by a lambda module") + @Group("Pausing") private val pauseIfPlacedLastTick by setting("Pause If Placed Last Tick", false, "Pauses walking on the tick after placing a block - Works with all placing") + + private var didPlaceLastTick = false + + private val SafeContext.breakQueued + get() = interaction.isBreakingBlock || + BreakManager.activeThisTick || + BreakManager.queuedRequest != null || + BreakManager.blockedPositions.isNotEmpty() + + private val placeQueued + get() = InteractManager.activeThisTick || + InteractManager.queuedRequest != null || + InteractManager.blockedPositions.isNotEmpty() init { + onDisable { didPlaceLastTick = false } + + listen { event -> + if (event.packet is PlayerInteractBlockC2SPacket) didPlaceLastTick = true + } + listen { event -> - event.input.update(forward = 1.0) - if (limitSpeed) event.input.movementVector = Vec2f(event.input.strafe, event.input.forward).normalize().multiply(speed.toFloat()) + val placedLastTick = didPlaceLastTick + didPlaceLastTick = false + + if (pauseIfPlacedLastTick && placedLastTick || + pauseWhileMining && breakQueued || + pauseWhilePlacing && placeQueued + ) return@listen + + val input = event.input + if (walkForward || walkBackward) input.forward = (walkForward.toDouble() - walkBackward.toDouble()).toFloat() + if (strafeLeft || strafeRight) input.strafe = (strafeRight.toDouble() - strafeLeft.toDouble()).toFloat() + if (sneak || sprint) input.update(sneak = sneak || input.sneaking, sprint = sprint || input.sprinting) + + if (limitSpeed) input.movementVector = Vec2f(input.strafe, input.forward).normalize().multiply(speed.toFloat()) } } -} \ No newline at end of file +} From cfde1c194f1e12ad63743a5ade92504fbc1c2371 Mon Sep 17 00:00:00 2001 From: pothemagicdragon Date: Tue, 21 Jul 2026 08:44:27 -0600 Subject: [PATCH 2/5] Stores groups in constants --- .../module/modules/movement/AutoWalk.kt | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt b/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt index 43b916ac3..aee674aeb 100644 --- a/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt +++ b/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt @@ -41,19 +41,23 @@ object AutoWalk : Module( description = "Automatically walks in the configured direction when certain conditions are met", tag = ModuleTag.MOVEMENT, ) { - @Group("Movement") private val walkForward by setting("Forward", true, "Automatically walks forward") - @Group("Movement") private val walkBackward by setting("Backward", false, "Automatically walks backward") - @Group("Movement") private val strafeLeft by setting("Strafe Left", false, "Automatically strafes left") - @Group("Movement") private val strafeRight by setting("Strafe Right", false, "Automatically strafes right") - @Group("Movement") private val sneak by setting("Sneak", false, "Automatically sneaks") - @Group("Movement") private val sprint by setting("Sprint", false, "Automatically sprints") + private const val MOVEMENT_GROUP = "Movement" + private const val SPEED_GROUP = "Speed" + private const val PAUSING_GROUP = "Pausing" - @Group("Speed") private val limitSpeed by setting("Limit Speed", false) - @Group("Speed") private val speed by setting("Speed", 0.5, 0.1..1.0, 0.05) { limitSpeed } + @Group(MOVEMENT_GROUP) private val walkForward by setting("Forward", true, "Automatically walks forward") + @Group(MOVEMENT_GROUP) private val walkBackward by setting("Backward", false, "Automatically walks backward") + @Group(MOVEMENT_GROUP) private val strafeLeft by setting("Strafe Left", false, "Automatically strafes left") + @Group(MOVEMENT_GROUP) private val strafeRight by setting("Strafe Right", false, "Automatically strafes right") + @Group(MOVEMENT_GROUP) private val sneak by setting("Sneak", false, "Automatically sneaks") + @Group(MOVEMENT_GROUP) private val sprint by setting("Sprint", false, "Automatically sprints") - @Group("Pausing") private val pauseWhileMining by setting("Pause While Mining", false, "Pauses walking while breaking blocks or when breaks are queued") - @Group("Pausing") private val pauseWhilePlacing by setting("Pause While Placing", false, "Pauses walking while placing blocks or when places are queued - only works with blocks placed by a lambda module") - @Group("Pausing") private val pauseIfPlacedLastTick by setting("Pause If Placed Last Tick", false, "Pauses walking on the tick after placing a block - Works with all placing") + @Group(SPEED_GROUP) private val limitSpeed by setting("Limit Speed", false) + @Group(SPEED_GROUP) private val speed by setting("Speed", 0.5, 0.1..1.0, 0.05) { limitSpeed } + + @Group(PAUSING_GROUP) private val pauseWhileMining by setting("Pause While Mining", false, "Pauses walking while breaking blocks or when breaks are queued") + @Group(PAUSING_GROUP) private val pauseWhilePlacing by setting("Pause While Placing", false, "Pauses walking while placing blocks or when places are queued - only works with blocks placed by a lambda module") + @Group(PAUSING_GROUP) private val pauseIfPlacedLastTick by setting("Pause If Placed Last Tick", false, "Pauses walking on the tick after placing a block - Works with all placing") private var didPlaceLastTick = false From e3ff19df83ce11e4693bcd270dd2e450ee72724d Mon Sep 17 00:00:00 2001 From: pothemagicdragon Date: Tue, 21 Jul 2026 08:44:49 -0600 Subject: [PATCH 3/5] rename placed last tick --- .../com/lambda/module/modules/movement/AutoWalk.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt b/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt index aee674aeb..437ed10a3 100644 --- a/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt +++ b/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt @@ -59,7 +59,7 @@ object AutoWalk : Module( @Group(PAUSING_GROUP) private val pauseWhilePlacing by setting("Pause While Placing", false, "Pauses walking while placing blocks or when places are queued - only works with blocks placed by a lambda module") @Group(PAUSING_GROUP) private val pauseIfPlacedLastTick by setting("Pause If Placed Last Tick", false, "Pauses walking on the tick after placing a block - Works with all placing") - private var didPlaceLastTick = false + private var placedLastTick = false private val SafeContext.breakQueued get() = interaction.isBreakingBlock || @@ -73,15 +73,15 @@ object AutoWalk : Module( InteractManager.blockedPositions.isNotEmpty() init { - onDisable { didPlaceLastTick = false } + onDisable { placedLastTick = false } listen { event -> - if (event.packet is PlayerInteractBlockC2SPacket) didPlaceLastTick = true + if (event.packet is PlayerInteractBlockC2SPacket) placedLastTick = true } listen { event -> - val placedLastTick = didPlaceLastTick - didPlaceLastTick = false + val placedLastTick = placedLastTick + AutoWalk.placedLastTick = false if (pauseIfPlacedLastTick && placedLastTick || pauseWhileMining && breakQueued || From ea2bcf44f9a1aaefc678cc948570e96fdae5e3a8 Mon Sep 17 00:00:00 2001 From: pothemagicdragon Date: Tue, 21 Jul 2026 08:46:39 -0600 Subject: [PATCH 4/5] converts speed setting to float --- .../kotlin/com/lambda/module/modules/movement/AutoWalk.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt b/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt index 437ed10a3..2d19ef2c4 100644 --- a/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt +++ b/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt @@ -53,7 +53,7 @@ object AutoWalk : Module( @Group(MOVEMENT_GROUP) private val sprint by setting("Sprint", false, "Automatically sprints") @Group(SPEED_GROUP) private val limitSpeed by setting("Limit Speed", false) - @Group(SPEED_GROUP) private val speed by setting("Speed", 0.5, 0.1..1.0, 0.05) { limitSpeed } + @Group(SPEED_GROUP) private val speed by setting("Speed", 0.5f, 0.1f..1.0f, 0.05f) { limitSpeed } @Group(PAUSING_GROUP) private val pauseWhileMining by setting("Pause While Mining", false, "Pauses walking while breaking blocks or when breaks are queued") @Group(PAUSING_GROUP) private val pauseWhilePlacing by setting("Pause While Placing", false, "Pauses walking while placing blocks or when places are queued - only works with blocks placed by a lambda module") @@ -93,7 +93,7 @@ object AutoWalk : Module( if (strafeLeft || strafeRight) input.strafe = (strafeRight.toDouble() - strafeLeft.toDouble()).toFloat() if (sneak || sprint) input.update(sneak = sneak || input.sneaking, sprint = sprint || input.sprinting) - if (limitSpeed) input.movementVector = Vec2f(input.strafe, input.forward).normalize().multiply(speed.toFloat()) + if (limitSpeed) input.movementVector = Vec2f(input.strafe, input.forward).normalize().multiply(speed) } } } From a91edc8780b951160842b617e6f0ee52b3af01cd Mon Sep 17 00:00:00 2001 From: pothemagicdragon Date: Tue, 21 Jul 2026 08:48:05 -0600 Subject: [PATCH 5/5] simplifies float/double conversion --- .../kotlin/com/lambda/module/modules/movement/AutoWalk.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt b/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt index 2d19ef2c4..57dcd93cf 100644 --- a/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt +++ b/src/main/kotlin/com/lambda/module/modules/movement/AutoWalk.kt @@ -26,7 +26,7 @@ import com.lambda.interaction.managers.breaking.BreakManager import com.lambda.interaction.managers.interacting.InteractManager import com.lambda.module.Module import com.lambda.module.tag.ModuleTag -import com.lambda.util.math.MathUtils.toDouble +import com.lambda.util.math.MathUtils.toFloat import com.lambda.util.player.MovementUtils.forward import com.lambda.util.player.MovementUtils.sneaking import com.lambda.util.player.MovementUtils.sprinting @@ -89,8 +89,8 @@ object AutoWalk : Module( ) return@listen val input = event.input - if (walkForward || walkBackward) input.forward = (walkForward.toDouble() - walkBackward.toDouble()).toFloat() - if (strafeLeft || strafeRight) input.strafe = (strafeRight.toDouble() - strafeLeft.toDouble()).toFloat() + if (walkForward || walkBackward) input.forward = (walkForward.toFloat() - walkBackward.toFloat()) + if (strafeLeft || strafeRight) input.strafe = (strafeRight.toFloat() - strafeLeft.toFloat()) if (sneak || sprint) input.update(sneak = sneak || input.sneaking, sprint = sprint || input.sprinting) if (limitSpeed) input.movementVector = Vec2f(input.strafe, input.forward).normalize().multiply(speed)