From b9e759272b08c24e31d0a60f171dcca1bd1cc9b1 Mon Sep 17 00:00:00 2001 From: cz Date: Sat, 26 Feb 2022 19:00:59 -0600 Subject: [PATCH 1/5] Various changes to packetfly, moved to separate module --- .../client/module/modules/movement/Flight.kt | 46 +------- .../module/modules/movement/PacketFly.kt | 111 ++++++++++++++++++ 2 files changed, 112 insertions(+), 45 deletions(-) create mode 100644 src/main/kotlin/com/lambda/client/module/modules/movement/PacketFly.kt diff --git a/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt b/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt index 50b3cdc87..0364110ae 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt @@ -1,21 +1,10 @@ package com.lambda.client.module.modules.movement -import com.lambda.client.event.Phase -import com.lambda.client.event.events.OnUpdateWalkingPlayerEvent -import com.lambda.client.event.events.PacketEvent import com.lambda.client.event.events.PlayerTravelEvent -import com.lambda.client.manager.managers.PlayerPacketManager.sendPlayerPacket import com.lambda.client.module.Category import com.lambda.client.module.Module -import com.lambda.client.util.MovementUtils -import com.lambda.client.util.MovementUtils.calcMoveYaw import com.lambda.client.util.threads.runSafe import com.lambda.client.util.threads.safeListener -import com.lambda.client.event.listener.listener -import net.minecraft.network.play.client.CPacketPlayer -import net.minecraft.network.play.server.SPacketCloseWindow -import kotlin.math.cos -import kotlin.math.sin object Flight : Module( name = "Flight", @@ -28,7 +17,7 @@ object Flight : Module( private val glideSpeed by setting("Glide Speed", 0.05, 0.0..0.3, 0.001) private enum class FlightMode { - VANILLA, STATIC, PACKET + VANILLA, STATIC } init { @@ -62,40 +51,7 @@ object Flight : Module( && !mc.gameSettings.keyBindJump.isKeyDown && !mc.gameSettings.keyBindSneak.isKeyDown) player.motionY = -glideSpeed } - FlightMode.PACKET -> { - it.cancel() - - player.motionY = if (mc.gameSettings.keyBindJump.isKeyDown xor mc.gameSettings.keyBindSneak.isKeyDown) { - if (mc.gameSettings.keyBindJump.isKeyDown) 0.0622 - else -0.0622 - } else { - if (MovementUtils.isInputting) { - val yaw = calcMoveYaw() - player.motionX = -sin(yaw) * 0.2f - player.motionZ = cos(yaw) * 0.2f - } - -glideSpeed - } - - val posX = player.posX + player.motionX - val posY = player.posY + player.motionY - val posZ = player.posZ + player.motionZ - - connection.sendPacket(CPacketPlayer.PositionRotation(posX, posY, posZ, player.rotationYaw, player.rotationPitch, false)) - connection.sendPacket(CPacketPlayer.Position(posX, player.posY - 42069, posZ, true)) - } } } - - listener { - if (mode != FlightMode.PACKET || it.phase != Phase.PRE) return@listener - sendPlayerPacket { - cancelAll() - } - } - - listener { - if (mode == FlightMode.PACKET && it.packet is SPacketCloseWindow) it.cancel() - } } } diff --git a/src/main/kotlin/com/lambda/client/module/modules/movement/PacketFly.kt b/src/main/kotlin/com/lambda/client/module/modules/movement/PacketFly.kt new file mode 100644 index 000000000..a1fd1894e --- /dev/null +++ b/src/main/kotlin/com/lambda/client/module/modules/movement/PacketFly.kt @@ -0,0 +1,111 @@ +package com.lambda.client.module.modules.movement + +import com.lambda.client.event.Phase +import com.lambda.client.event.events.ConnectionEvent +import com.lambda.client.event.events.OnUpdateWalkingPlayerEvent +import com.lambda.client.event.events.PacketEvent +import com.lambda.client.event.events.PlayerTravelEvent +import com.lambda.client.event.listener.listener +import com.lambda.client.manager.managers.PlayerPacketManager.sendPlayerPacket +import com.lambda.client.mixin.extension.playerPosLookPitch +import com.lambda.client.mixin.extension.playerPosLookYaw +import com.lambda.client.module.Category +import com.lambda.client.module.Module +import com.lambda.client.util.MovementUtils +import com.lambda.client.util.MovementUtils.calcMoveYaw +import com.lambda.client.util.threads.safeListener +import net.minecraft.network.play.client.CPacketConfirmTeleport +import net.minecraft.network.play.client.CPacketPlayer +import net.minecraft.network.play.server.SPacketCloseWindow +import net.minecraft.network.play.server.SPacketPlayerPosLook +import kotlin.math.cos +import kotlin.math.sin + +object PacketFly : Module( + name = "PacketFly", + category = Category.MOVEMENT, + description = "Slower flight module that works on most servers", + alwaysListening = true +) { + private val mode by setting("Mode", Mode.NEGATIVE) + private val speed by setting("Speed", 1.0f, 0.0f..10.0f, 0.1f) + private val glideSpeed by setting("Glide Speed", 0.034, 0.0..0.3, 0.001) + private val upSpeed by setting("Up Speed", 0.0622, 0.0..0.3, 0.001) + private val antiKick by setting("Anti Kick", true) + private val antiKickSpeed by setting("Anti Kick Speed", 0.0622, 0.0..0.3, 0.001) + private val antiKickDelay by setting("Anti Kick Delay", 14, 0..100, 1) + private val hShrinkAmount by setting("Horizontal Shrink Amount", 4.0, 1.0..10.0, 0.1) + private val vShrinkAmount by setting("Vertical Shrink Amount", 2.70, 1.0..10.0, 0.1) + + private enum class Mode { + POSITIVE, NEGATIVE + } + + private var teleportID = -1 + + init { + safeListener { + teleportID = -1 + disable() + } + + safeListener { + if (isDisabled) return@safeListener + + it.cancel() + + player.motionY = if (mc.gameSettings.keyBindJump.isKeyDown xor mc.gameSettings.keyBindSneak.isKeyDown) { + if (mc.gameSettings.keyBindJump.isKeyDown) { + if (player.ticksExisted % antiKickDelay != 0) { + upSpeed / vShrinkAmount + } else -antiKickSpeed / vShrinkAmount + } else (-upSpeed / vShrinkAmount) + } else { + if (MovementUtils.isInputting) { + val yaw = calcMoveYaw() + player.motionX = (-sin(yaw) * 0.2f * speed) / hShrinkAmount + player.motionZ = (cos(yaw) * 0.2f * speed) / hShrinkAmount + } + -glideSpeed / vShrinkAmount + } + + val antiKickOffset = if (player.ticksExisted % (antiKickDelay + 1) == 0 && antiKick) -antiKickSpeed else 0.0 + + val posX = player.posX + (player.motionX * hShrinkAmount) + val posY = player.posY + (player.motionY * vShrinkAmount) + antiKickOffset + val posZ = player.posZ + (player.motionZ * hShrinkAmount) + + val invalidPacketOffset = when (mode) { + Mode.POSITIVE -> 1000 + Mode.NEGATIVE -> -1000 + } + + connection.sendPacket(CPacketPlayer.Position(posX, posY, posZ, false)) + connection.sendPacket(CPacketPlayer.Position(posX, player.posY + invalidPacketOffset, posZ, false)) + if (teleportID != -1) connection.sendPacket(CPacketConfirmTeleport(teleportID++)) + } + + listener { + if (it.phase != Phase.PRE || isDisabled) return@listener + sendPlayerPacket { + cancelAll() + } + } + + safeListener { + when (it.packet) { + is SPacketPlayerPosLook -> { + teleportID = it.packet.teleportId + + if (isEnabled) { + it.packet.playerPosLookYaw = player.rotationYaw + it.packet.playerPosLookPitch = player.rotationPitch + } + } + is SPacketCloseWindow -> { + if (isEnabled) it.cancel() + } + } + } + } +} From c7b865abd78b1ed0f2fd2e5aa50fa1a99302d997 Mon Sep 17 00:00:00 2001 From: Constructor Date: Tue, 1 Mar 2022 21:23:21 +0100 Subject: [PATCH 2/5] Move to Flight module and use PacketManager --- .../client/manager/managers/PacketManager.kt | 26 ++++++ .../client/module/modules/movement/Flight.kt | 89 ++++++++++++++++++- 2 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 src/main/kotlin/com/lambda/client/manager/managers/PacketManager.kt diff --git a/src/main/kotlin/com/lambda/client/manager/managers/PacketManager.kt b/src/main/kotlin/com/lambda/client/manager/managers/PacketManager.kt new file mode 100644 index 000000000..7e9ed03ba --- /dev/null +++ b/src/main/kotlin/com/lambda/client/manager/managers/PacketManager.kt @@ -0,0 +1,26 @@ +package com.lambda.client.manager.managers + +import com.lambda.client.event.events.ConnectionEvent +import com.lambda.client.event.events.PacketEvent +import com.lambda.client.event.listener.listener +import com.lambda.client.manager.Manager +import com.lambda.client.util.threads.safeListener +import net.minecraft.network.play.server.SPacketPlayerPosLook + +object PacketManager : Manager { + var lastTeleportId = -1 + + init { + listener { + when (it.packet) { + is SPacketPlayerPosLook -> { + lastTeleportId = it.packet.teleportId + } + } + } + + safeListener { + lastTeleportId = -1 + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt b/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt index 0364110ae..4d8cb8b3d 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt @@ -1,10 +1,28 @@ package com.lambda.client.module.modules.movement +import com.lambda.client.event.Phase +import com.lambda.client.event.events.ConnectionEvent +import com.lambda.client.event.events.OnUpdateWalkingPlayerEvent +import com.lambda.client.event.events.PacketEvent import com.lambda.client.event.events.PlayerTravelEvent +import com.lambda.client.event.listener.listener +import com.lambda.client.manager.managers.PacketManager +import com.lambda.client.manager.managers.PlayerPacketManager.sendPlayerPacket +import com.lambda.client.mixin.extension.playerPosLookPitch +import com.lambda.client.mixin.extension.playerPosLookYaw import com.lambda.client.module.Category import com.lambda.client.module.Module +import com.lambda.client.module.modules.movement.PacketFly.setting +import com.lambda.client.util.MovementUtils +import com.lambda.client.util.MovementUtils.calcMoveYaw import com.lambda.client.util.threads.runSafe import com.lambda.client.util.threads.safeListener +import net.minecraft.network.play.client.CPacketConfirmTeleport +import net.minecraft.network.play.client.CPacketPlayer +import net.minecraft.network.play.server.SPacketCloseWindow +import net.minecraft.network.play.server.SPacketPlayerPosLook +import kotlin.math.cos +import kotlin.math.sin object Flight : Module( name = "Flight", @@ -12,12 +30,23 @@ object Flight : Module( description = "Makes the player fly", modulePriority = 500 ) { - private val mode by setting("Mode", FlightMode.VANILLA) + private val mode by setting("Mode", FlightMode.PACKET) private val speed by setting("Speed", 1.0f, 0.0f..10.0f, 0.1f) private val glideSpeed by setting("Glide Speed", 0.05, 0.0..0.3, 0.001) + private val packetMode by setting("Packet Mode", PacketMode.NEGATIVE) + private val upSpeed by setting("Up Speed", 0.0622, 0.0..0.3, 0.001, { mode == FlightMode.PACKET }) + private val antiKick by setting("Anti Kick", true, { mode == FlightMode.PACKET }) + private val antiKickSpeed by setting("Anti Kick Speed", 0.0622, 0.0..0.3, 0.001) + private val antiKickDelay by setting("Anti Kick Delay", 14, 0..100, 1) + private val hShrinkAmount by setting("Horizontal Shrink Amount", 4.0, 1.0..10.0, 0.1) + private val vShrinkAmount by setting("Vertical Shrink Amount", 2.70, 1.0..10.0, 0.1) private enum class FlightMode { - VANILLA, STATIC + PACKET, VANILLA, STATIC + } + + private enum class PacketMode { + POSITIVE, NEGATIVE } init { @@ -32,6 +61,43 @@ object Flight : Module( safeListener { when (mode) { + FlightMode.PACKET -> { + it.cancel() + + player.motionY = if (mc.gameSettings.keyBindJump.isKeyDown xor mc.gameSettings.keyBindSneak.isKeyDown) { + if (mc.gameSettings.keyBindJump.isKeyDown) { + if (player.ticksExisted % antiKickDelay != 0) { + upSpeed / vShrinkAmount + } else { + -antiKickSpeed / vShrinkAmount + } + } else (-upSpeed / vShrinkAmount) + } else { + if (MovementUtils.isInputting) { + val yaw = calcMoveYaw() + player.motionX = (-sin(yaw) * 0.2f * speed) / hShrinkAmount + player.motionZ = (cos(yaw) * 0.2f * speed) / hShrinkAmount + } + -glideSpeed / vShrinkAmount + } + + val antiKickOffset = if (player.ticksExisted % (antiKickDelay + 1) == 0 && antiKick) -antiKickSpeed else 0.0 + + val posX = player.posX + (player.motionX * hShrinkAmount) + val posY = player.posY + (player.motionY * vShrinkAmount) + antiKickOffset + val posZ = player.posZ + (player.motionZ * hShrinkAmount) + + val invalidPacketOffset = when (packetMode) { + PacketMode.POSITIVE -> 1000 + PacketMode.NEGATIVE -> -1000 + } + + connection.sendPacket(CPacketPlayer.Position(posX, posY, posZ, false)) + connection.sendPacket(CPacketPlayer.Position(posX, player.posY + invalidPacketOffset, posZ, false)) + if (PacketManager.lastTeleportId != -1) { + connection.sendPacket(CPacketConfirmTeleport(PacketManager.lastTeleportId++)) + } + } FlightMode.STATIC -> { player.capabilities.isFlying = true player.capabilities.flySpeed = speed @@ -53,5 +119,24 @@ object Flight : Module( } } } + + listener { + if (it.phase != Phase.PRE) return@listener + sendPlayerPacket { + cancelAll() + } + } + + safeListener { + when (it.packet) { + is SPacketPlayerPosLook -> { + it.packet.playerPosLookYaw = player.rotationYaw + it.packet.playerPosLookPitch = player.rotationPitch + } + is SPacketCloseWindow -> { + it.cancel() + } + } + } } } From 4d25119af1b26c6d1995db4686f1ae70566b3149 Mon Sep 17 00:00:00 2001 From: Constructor Date: Tue, 1 Mar 2022 21:24:13 +0100 Subject: [PATCH 3/5] Cleanup --- .../client/module/modules/movement/Flight.kt | 2 - .../module/modules/movement/PacketFly.kt | 111 ------------------ 2 files changed, 113 deletions(-) delete mode 100644 src/main/kotlin/com/lambda/client/module/modules/movement/PacketFly.kt diff --git a/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt b/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt index 4d8cb8b3d..49920b82a 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt @@ -1,7 +1,6 @@ package com.lambda.client.module.modules.movement import com.lambda.client.event.Phase -import com.lambda.client.event.events.ConnectionEvent import com.lambda.client.event.events.OnUpdateWalkingPlayerEvent import com.lambda.client.event.events.PacketEvent import com.lambda.client.event.events.PlayerTravelEvent @@ -12,7 +11,6 @@ import com.lambda.client.mixin.extension.playerPosLookPitch import com.lambda.client.mixin.extension.playerPosLookYaw import com.lambda.client.module.Category import com.lambda.client.module.Module -import com.lambda.client.module.modules.movement.PacketFly.setting import com.lambda.client.util.MovementUtils import com.lambda.client.util.MovementUtils.calcMoveYaw import com.lambda.client.util.threads.runSafe diff --git a/src/main/kotlin/com/lambda/client/module/modules/movement/PacketFly.kt b/src/main/kotlin/com/lambda/client/module/modules/movement/PacketFly.kt deleted file mode 100644 index a1fd1894e..000000000 --- a/src/main/kotlin/com/lambda/client/module/modules/movement/PacketFly.kt +++ /dev/null @@ -1,111 +0,0 @@ -package com.lambda.client.module.modules.movement - -import com.lambda.client.event.Phase -import com.lambda.client.event.events.ConnectionEvent -import com.lambda.client.event.events.OnUpdateWalkingPlayerEvent -import com.lambda.client.event.events.PacketEvent -import com.lambda.client.event.events.PlayerTravelEvent -import com.lambda.client.event.listener.listener -import com.lambda.client.manager.managers.PlayerPacketManager.sendPlayerPacket -import com.lambda.client.mixin.extension.playerPosLookPitch -import com.lambda.client.mixin.extension.playerPosLookYaw -import com.lambda.client.module.Category -import com.lambda.client.module.Module -import com.lambda.client.util.MovementUtils -import com.lambda.client.util.MovementUtils.calcMoveYaw -import com.lambda.client.util.threads.safeListener -import net.minecraft.network.play.client.CPacketConfirmTeleport -import net.minecraft.network.play.client.CPacketPlayer -import net.minecraft.network.play.server.SPacketCloseWindow -import net.minecraft.network.play.server.SPacketPlayerPosLook -import kotlin.math.cos -import kotlin.math.sin - -object PacketFly : Module( - name = "PacketFly", - category = Category.MOVEMENT, - description = "Slower flight module that works on most servers", - alwaysListening = true -) { - private val mode by setting("Mode", Mode.NEGATIVE) - private val speed by setting("Speed", 1.0f, 0.0f..10.0f, 0.1f) - private val glideSpeed by setting("Glide Speed", 0.034, 0.0..0.3, 0.001) - private val upSpeed by setting("Up Speed", 0.0622, 0.0..0.3, 0.001) - private val antiKick by setting("Anti Kick", true) - private val antiKickSpeed by setting("Anti Kick Speed", 0.0622, 0.0..0.3, 0.001) - private val antiKickDelay by setting("Anti Kick Delay", 14, 0..100, 1) - private val hShrinkAmount by setting("Horizontal Shrink Amount", 4.0, 1.0..10.0, 0.1) - private val vShrinkAmount by setting("Vertical Shrink Amount", 2.70, 1.0..10.0, 0.1) - - private enum class Mode { - POSITIVE, NEGATIVE - } - - private var teleportID = -1 - - init { - safeListener { - teleportID = -1 - disable() - } - - safeListener { - if (isDisabled) return@safeListener - - it.cancel() - - player.motionY = if (mc.gameSettings.keyBindJump.isKeyDown xor mc.gameSettings.keyBindSneak.isKeyDown) { - if (mc.gameSettings.keyBindJump.isKeyDown) { - if (player.ticksExisted % antiKickDelay != 0) { - upSpeed / vShrinkAmount - } else -antiKickSpeed / vShrinkAmount - } else (-upSpeed / vShrinkAmount) - } else { - if (MovementUtils.isInputting) { - val yaw = calcMoveYaw() - player.motionX = (-sin(yaw) * 0.2f * speed) / hShrinkAmount - player.motionZ = (cos(yaw) * 0.2f * speed) / hShrinkAmount - } - -glideSpeed / vShrinkAmount - } - - val antiKickOffset = if (player.ticksExisted % (antiKickDelay + 1) == 0 && antiKick) -antiKickSpeed else 0.0 - - val posX = player.posX + (player.motionX * hShrinkAmount) - val posY = player.posY + (player.motionY * vShrinkAmount) + antiKickOffset - val posZ = player.posZ + (player.motionZ * hShrinkAmount) - - val invalidPacketOffset = when (mode) { - Mode.POSITIVE -> 1000 - Mode.NEGATIVE -> -1000 - } - - connection.sendPacket(CPacketPlayer.Position(posX, posY, posZ, false)) - connection.sendPacket(CPacketPlayer.Position(posX, player.posY + invalidPacketOffset, posZ, false)) - if (teleportID != -1) connection.sendPacket(CPacketConfirmTeleport(teleportID++)) - } - - listener { - if (it.phase != Phase.PRE || isDisabled) return@listener - sendPlayerPacket { - cancelAll() - } - } - - safeListener { - when (it.packet) { - is SPacketPlayerPosLook -> { - teleportID = it.packet.teleportId - - if (isEnabled) { - it.packet.playerPosLookYaw = player.rotationYaw - it.packet.playerPosLookPitch = player.rotationPitch - } - } - is SPacketCloseWindow -> { - if (isEnabled) it.cancel() - } - } - } - } -} From 4a8b93d092952d62469b300a2e43640fc15a5399 Mon Sep 17 00:00:00 2001 From: Constructor Date: Tue, 1 Mar 2022 21:35:11 +0100 Subject: [PATCH 4/5] Forgot this check --- .../kotlin/com/lambda/client/module/modules/movement/Flight.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt b/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt index 49920b82a..5ec9e4d7a 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt @@ -119,13 +119,14 @@ object Flight : Module( } listener { - if (it.phase != Phase.PRE) return@listener + if (it.phase != Phase.PRE || mode != FlightMode.PACKET) return@listener sendPlayerPacket { cancelAll() } } safeListener { + if (mode != FlightMode.PACKET) return@safeListener when (it.packet) { is SPacketPlayerPosLook -> { it.packet.playerPosLookYaw = player.rotationYaw From 3631715c95c727aa4f3edb44c25e09912dac8c3a Mon Sep 17 00:00:00 2001 From: cz Date: Wed, 2 Mar 2022 12:47:38 -0600 Subject: [PATCH 5/5] Fix double antikick and made sure settings are not displayed when they shouldnt be --- .../client/module/modules/movement/Flight.kt | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt b/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt index 5ec9e4d7a..d4040d14a 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/movement/Flight.kt @@ -31,13 +31,13 @@ object Flight : Module( private val mode by setting("Mode", FlightMode.PACKET) private val speed by setting("Speed", 1.0f, 0.0f..10.0f, 0.1f) private val glideSpeed by setting("Glide Speed", 0.05, 0.0..0.3, 0.001) - private val packetMode by setting("Packet Mode", PacketMode.NEGATIVE) + private val packetMode by setting("Packet Mode", PacketMode.NEGATIVE, { mode == FlightMode.PACKET }) private val upSpeed by setting("Up Speed", 0.0622, 0.0..0.3, 0.001, { mode == FlightMode.PACKET }) private val antiKick by setting("Anti Kick", true, { mode == FlightMode.PACKET }) - private val antiKickSpeed by setting("Anti Kick Speed", 0.0622, 0.0..0.3, 0.001) - private val antiKickDelay by setting("Anti Kick Delay", 14, 0..100, 1) - private val hShrinkAmount by setting("Horizontal Shrink Amount", 4.0, 1.0..10.0, 0.1) - private val vShrinkAmount by setting("Vertical Shrink Amount", 2.70, 1.0..10.0, 0.1) + private val antiKickSpeed by setting("Anti Kick Speed", 0.0622, 0.0..0.3, 0.001, { mode == FlightMode.PACKET && antiKick }) + private val antiKickDelay by setting("Anti Kick Delay", 14, 0..100, 1, { mode == FlightMode.PACKET && antiKick}) + private val hShrinkAmount by setting("Horizontal Shrink Amount", 4.0, 1.0..10.0, 0.1, { mode == FlightMode.PACKET }) + private val vShrinkAmount by setting("Vertical Shrink Amount", 2.70, 1.0..10.0, 0.1, { mode == FlightMode.PACKET }) private enum class FlightMode { PACKET, VANILLA, STATIC @@ -64,10 +64,10 @@ object Flight : Module( player.motionY = if (mc.gameSettings.keyBindJump.isKeyDown xor mc.gameSettings.keyBindSneak.isKeyDown) { if (mc.gameSettings.keyBindJump.isKeyDown) { - if (player.ticksExisted % antiKickDelay != 0) { - upSpeed / vShrinkAmount - } else { + if (player.ticksExisted % antiKickDelay == 0 && antiKick) { -antiKickSpeed / vShrinkAmount + } else { + upSpeed / vShrinkAmount } } else (-upSpeed / vShrinkAmount) } else { @@ -79,10 +79,8 @@ object Flight : Module( -glideSpeed / vShrinkAmount } - val antiKickOffset = if (player.ticksExisted % (antiKickDelay + 1) == 0 && antiKick) -antiKickSpeed else 0.0 - val posX = player.posX + (player.motionX * hShrinkAmount) - val posY = player.posY + (player.motionY * vShrinkAmount) + antiKickOffset + val posY = player.posY + (player.motionY * vShrinkAmount) val posZ = player.posZ + (player.motionZ * hShrinkAmount) val invalidPacketOffset = when (packetMode) {