Skip to content

Commit 23c15b2

Browse files
authored
AutoWalk (#238)
1 parent 9f1feb4 commit 23c15b2

File tree

1 file changed

+47
-0
lines changed
  • src/main/kotlin/com/lambda/module/modules/movement

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright 2026 Lambda
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
package com.lambda.module.modules.movement
19+
20+
import com.lambda.event.events.MovementEvent
21+
import com.lambda.event.events.TickEvent
22+
import com.lambda.event.listener.SafeListener.Companion.listen
23+
import com.lambda.module.Module
24+
import com.lambda.module.tag.ModuleTag
25+
import com.lambda.util.Timer
26+
import com.lambda.util.player.MovementUtils.forward
27+
import com.lambda.util.player.MovementUtils.strafe
28+
import com.lambda.util.player.MovementUtils.update
29+
import net.minecraft.util.math.Vec2f
30+
import kotlin.time.DurationUnit
31+
import kotlin.time.toDuration
32+
33+
class AutoWalk : Module(
34+
name = "AutoWalk",
35+
description = "Automatically makes your character walk forward",
36+
tag = ModuleTag.MOVEMENT,
37+
) {
38+
val limitSpeed by setting("Limit Speed", false)
39+
val speed by setting("Speed", 0.5, 0.1..1.0, 0.05) { limitSpeed }
40+
41+
init {
42+
listen<MovementEvent.InputUpdate> { event ->
43+
event.input.update(forward = 1.0)
44+
if (limitSpeed) event.input.movementVector = Vec2f(event.input.strafe, event.input.forward).normalize().multiply(speed.toFloat())
45+
}
46+
}
47+
}

0 commit comments

Comments
 (0)