Skip to content

Commit 11a6c5a

Browse files
committed
MovementUtils cleanup
1 parent 8b01be8 commit 11a6c5a

File tree

1 file changed

+13
-29
lines changed

1 file changed

+13
-29
lines changed

common/src/main/kotlin/com/lambda/util/player/MovementUtils.kt

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,36 +25,20 @@ object MovementUtils {
2525
val Input.isInputting get() = roundedForward != 0.0 || roundedStrafing != 0.0
2626
val SafeContext.isInputting get() = player.input.isInputting
2727

28-
fun SafeContext.newMovementInput(assumeBaritoneUsage: Boolean = true, slowDownCheck: Boolean = true): Input {
29-
val input = if (assumeBaritoneUsage && player.input.handledByBaritone) {
30-
player.input
31-
} else {
32-
var multiplier = 1f
33-
34-
if (slowDownCheck && player.shouldSlowDown()) multiplier =
35-
0.3f + getSwiftSneakSpeedBoost(player)
36-
37-
KeyboardInput(mc.options).apply {
38-
tick(true, multiplier.coerceIn(0f, 1f))
39-
}
28+
fun SafeContext.newMovementInput(
29+
assumeBaritoneUsage: Boolean = true,
30+
slowDownCheck: Boolean = true
31+
): Input = if (assumeBaritoneUsage && player.input.handledByBaritone) {
32+
player.input
33+
} else {
34+
var multiplier = 1f
35+
36+
if (slowDownCheck && player.shouldSlowDown()) multiplier =
37+
0.3f + getSwiftSneakSpeedBoost(player)
38+
39+
KeyboardInput(mc.options).apply {
40+
tick(true, multiplier.coerceIn(0f, 1f))
4041
}
41-
42-
return input
43-
}
44-
45-
fun Input.mergeFrom(source: Input): Input {
46-
movementForward = source.movementForward
47-
movementSideways = source.movementSideways
48-
49-
pressingForward = source.pressingForward
50-
pressingBack = source.pressingBack
51-
pressingLeft = source.pressingLeft
52-
pressingRight = source.pressingRight
53-
54-
jumping = source.jumping
55-
sneaking = source.sneaking
56-
57-
return this
5842
}
5943

6044
fun Input.cancel(cancelVertical: Boolean = true) {

0 commit comments

Comments
 (0)