You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description = "Automatically makes your character walk forward",
40
+
description = "Automatically walks in the configured direction when certain conditions are met",
33
41
tag = ModuleTag.MOVEMENT,
34
42
) {
35
-
val limitSpeed by setting("Limit Speed", false)
36
-
val speed by setting("Speed", 0.5, 0.1..1.0, 0.05) { limitSpeed }
43
+
privateconstvalMOVEMENT_GROUP="Movement"
44
+
privateconstvalPAUSING_GROUP="Pausing"
45
+
46
+
@Group(MOVEMENT_GROUP) privateval walkForward by setting("Forward", true, "Automatically walks forward")
47
+
@Group(MOVEMENT_GROUP) privateval walkBackward by setting("Backward", false, "Automatically walks backward")
48
+
@Group(MOVEMENT_GROUP) privateval strafeLeft by setting("Strafe Left", false, "Automatically strafes left")
49
+
@Group(MOVEMENT_GROUP) privateval strafeRight by setting("Strafe Right", false, "Automatically strafes right")
50
+
@Group(MOVEMENT_GROUP) privateval sneak by setting("Sneak", false, "Automatically sneaks")
51
+
@Group(MOVEMENT_GROUP) privateval sprint by setting("Sprint", false, "Automatically sprints")
52
+
53
+
@Group(PAUSING_GROUP) privateval pauseWhileMining by setting("Pause While Mining", false, "Pauses walking while breaking blocks or when breaks are queued")
54
+
@Group(PAUSING_GROUP) privateval 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")
55
+
@Group(PAUSING_GROUP) privateval pauseAfterPlacing by setting("Pause After Placing", false, "Pauses walking for a period after placing a block - Works with all placing")
56
+
@Group(PAUSING_GROUP) privateval ticksToWaitAfterPlacing by setting("Ticks To Wait After Placing", 1, 1..20, 1, "Extends the pause after placing to this many ticks") { pauseAfterPlacing }
57
+
58
+
privatevar placeWaitTicks =0
59
+
60
+
privatevalSafeContext.breakQueued
61
+
get() = interaction.isBreakingBlock ||
62
+
BreakManager.activeThisTick ||
63
+
BreakManager.queuedRequest !=null||
64
+
BreakManager.blockedPositions.isNotEmpty()
65
+
66
+
privateval placeQueued
67
+
get() =InteractManager.activeThisTick ||
68
+
InteractManager.queuedRequest !=null||
69
+
InteractManager.blockedPositions.isNotEmpty()
37
70
38
71
init {
72
+
73
+
listen<PacketEvent.Send.Pre> { event ->
74
+
if (event.packet isPlayerInteractBlockC2SPacket&& pauseAfterPlacing)
75
+
placeWaitTicks = ticksToWaitAfterPlacing
76
+
}
77
+
39
78
listen<MovementEvent.InputUpdate> { event ->
40
-
event.input.update(forward =1.0)
41
-
if (limitSpeed) event.input.movementVector =Vec2f(event.input.strafe, event.input.forward).normalize().multiply(speed.toFloat())
79
+
val waitingAfterPlacing = placeWaitTicks >0
80
+
if (placeWaitTicks >0) placeWaitTicks--
81
+
82
+
if (pauseAfterPlacing && waitingAfterPlacing ||
83
+
pauseWhileMining && breakQueued ||
84
+
pauseWhilePlacing && placeQueued
85
+
) return@listen
86
+
87
+
val input = event.input
88
+
val forward =if (walkForward || walkBackward) walkForward.toDouble() - walkBackward.toDouble()
89
+
else input.roundedForward
90
+
val strafe =if (strafeLeft || strafeRight) strafeLeft.toDouble() - strafeRight.toDouble()
0 commit comments