Skip to content

Commit d576d39

Browse files
committed
Minor cleanup
1 parent b58c40e commit d576d39

File tree

1 file changed

+19
-19
lines changed
  • src/main/kotlin/com/lambda/client/module/modules/movement

1 file changed

+19
-19
lines changed

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ object Speed : Module(
4949
private val strafeAutoJump by setting("Auto Jump", false, { mode == Mode.STRAFE })
5050

5151
// YPort settings
52-
private val yPortAccelerate by setting("Accelerate", true, { mode == Mode.YPORT })
53-
private val yPortStrict by setting("Head Strict", false, { mode == Mode.YPORT }, description = "Only allow YPort when you are under a block")
54-
private val yPortAirStrict by setting("Air Strict", false, { mode == Mode.YPORT }, description = "Force YPort to handle Y movement differently, slows this down A LOT")
55-
private val yPortMaxSpeed by setting("Maximum Speed", 0.0, 0.0..2.0, 0.001, { mode == Mode.YPORT })
56-
private val yPortAcceleration by setting("Acceleration Speed", 2.149, 1.0..5.0, 0.001, { mode == Mode.YPORT })
57-
private val yPortDecay by setting("YPort Decay", 0.66, 0.0..1.0, 0.001, { mode == Mode.YPORT })
58-
private val yPortTimer by setting("YPort Timer", 1.09f, 1.0f..1.1f, 0.01f, { mode == Mode.YPORT })
52+
private val yPortAccelerate by setting("Accelerate", true, { mode == Mode.Y_PORT })
53+
private val yPortStrict by setting("Head Strict", false, { mode == Mode.Y_PORT }, description = "Only allow YPort when you are under a block")
54+
private val yPortAirStrict by setting("Air Strict", false, { mode == Mode.Y_PORT }, description = "Force YPort to handle Y movement differently, slows this down A LOT")
55+
private val yPortMaxSpeed by setting("Maximum Speed", 0.0, 0.0..2.0, 0.001, { mode == Mode.Y_PORT })
56+
private val yPortAcceleration by setting("Acceleration Speed", 2.149, 1.0..5.0, 0.001, { mode == Mode.Y_PORT })
57+
private val yPortDecay by setting("YPort Decay", 0.66, 0.0..1.0, 0.001, { mode == Mode.Y_PORT })
58+
private val yPortTimer by setting("YPort Timer", 1.09f, 1.0f..1.1f, 0.01f, { mode == Mode.Y_PORT })
5959

6060
private const val NCP_BASE_SPEED = 0.2873
6161

@@ -95,12 +95,12 @@ object Speed : Module(
9595

9696
private enum class Mode(override val displayName: String, val move: SafeClientEvent.(e: PlayerMoveEvent) -> Unit) : DisplayEnum {
9797
STRAFE("Strafe", { handleStrafe(it) }),
98-
YPORT("YPort", { handleBoost(it) }),
98+
Y_PORT("YPort", { handleBoost(it) }),
9999
}
100100

101101
init {
102102
onEnable {
103-
currentSpeed = if (mode == Mode.YPORT) NCP_BASE_SPEED else strafeBaseSpeed
103+
currentSpeed = if (mode == Mode.Y_PORT) NCP_BASE_SPEED else strafeBaseSpeed
104104
strafePhase = StrafePhase.FALLING
105105
yPortPhase = YPortPhase.WALKING
106106
prevYPortPhase = YPortPhase.WALKING
@@ -121,7 +121,7 @@ object Speed : Module(
121121
}
122122

123123
safeListener<PacketEvent.Send> {
124-
if (mode != Mode.YPORT
124+
if (mode != Mode.Y_PORT
125125
|| it.packet !is CPacketPlayer
126126
|| !goUp
127127
) return@safeListener
@@ -138,10 +138,9 @@ object Speed : Module(
138138

139139
val unModOffset = offset
140140

141-
if (currentY + unModOffset > 0)
141+
if (currentY + unModOffset > 0) {
142142
offset += currentY
143-
else if (yPortAirStrict && yPortPhase == YPortPhase.FALLING && prevYPortPhase == YPortPhase.FALLING) {
144-
143+
} else if (yPortAirStrict && yPortPhase == YPortPhase.FALLING && prevYPortPhase == YPortPhase.FALLING) {
145144
var predictedY = currentY
146145
predictedY -= 0.08
147146
predictedY *= 0.9800000190734863 // 0.333200006 vs 0.341599999
@@ -157,7 +156,7 @@ object Speed : Module(
157156
}
158157

159158
safeListener<PacketEvent.Receive> {
160-
if (mode != Mode.YPORT || it.packet !is SPacketPlayerPosLook) return@safeListener
159+
if (mode != Mode.Y_PORT || it.packet !is SPacketPlayerPosLook) return@safeListener
161160

162161
currentSpeed = 0.0
163162
currentY = 0.0
@@ -222,7 +221,7 @@ object Speed : Module(
222221

223222
else -> {
224223
currentSpeed = max(currentSpeed, NCP_BASE_SPEED)
225-
yPortPhase = YPortPhase.values()[yPortPhase.ordinal + 1 % YPortPhase.values().size]
224+
yPortPhase = YPortPhase.entries.toTypedArray()[yPortPhase.ordinal + 1 % YPortPhase.entries.size]
226225
goUp = false
227226
}
228227
}
@@ -256,8 +255,9 @@ object Speed : Module(
256255

257256
val shouldJump = player.movementInput.jump || (inputting && strafeAutoJump)
258257

259-
if (player.onGround && shouldJump)
258+
if (player.onGround && shouldJump) {
260259
strafePhase = StrafePhase.JUMP
260+
}
261261

262262
strafePhase = when (strafePhase) {
263263
StrafePhase.JUMP -> {
@@ -282,8 +282,9 @@ object Speed : Module(
282282
}
283283
}
284284

285-
if (player.onGround && !shouldJump)
285+
if (player.onGround && !shouldJump) {
286286
currentSpeed = strafeBaseSpeed
287+
}
287288

288289
currentSpeed = currentSpeed.coerceAtLeast(strafeBaseSpeed).coerceAtMost(strafeMaxSpeed)
289290

@@ -300,6 +301,5 @@ object Speed : Module(
300301
}
301302

302303
// For HoleSnap & Surround
303-
fun isStrafing() =
304-
mode == Mode.STRAFE
304+
fun isStrafing() = mode == Mode.STRAFE
305305
}

0 commit comments

Comments
 (0)