diff --git a/src/main/java/net/ccbluex/liquidbounce/injection/mixins/minecraft/client/MixinKeyboardInput.java b/src/main/java/net/ccbluex/liquidbounce/injection/mixins/minecraft/client/MixinKeyboardInput.java index 651987ceb27..38953a556ee 100644 --- a/src/main/java/net/ccbluex/liquidbounce/injection/mixins/minecraft/client/MixinKeyboardInput.java +++ b/src/main/java/net/ccbluex/liquidbounce/injection/mixins/minecraft/client/MixinKeyboardInput.java @@ -76,7 +76,7 @@ private PlayerInput modifyInput(PlayerInput original) { EventManager.INSTANCE.callEvent(event); var directionalInput = changeDirection(event.getDirectionalInput()); - var sprintEvent = new SprintEvent(original.sprint(), SprintEvent.Source.INPUT); + var sprintEvent = new SprintEvent(directionalInput, original.sprint(), SprintEvent.Source.INPUT); EventManager.INSTANCE.callEvent(sprintEvent); return new PlayerInput( diff --git a/src/main/kotlin/net/ccbluex/liquidbounce/event/events/GameEvents.kt b/src/main/kotlin/net/ccbluex/liquidbounce/event/events/GameEvents.kt index 9e0a8ffcf3a..3ecd0aa12cb 100644 --- a/src/main/kotlin/net/ccbluex/liquidbounce/event/events/GameEvents.kt +++ b/src/main/kotlin/net/ccbluex/liquidbounce/event/events/GameEvents.kt @@ -61,11 +61,11 @@ class MovementInputEvent( ) : Event() @Nameable("sprint") -class SprintEvent(var sprint: Boolean, val source: Source) : Event() { - enum class Source(val key: Boolean) { - INPUT(true), - MOVEMENT_TICK(true), - NETWORK(false) +class SprintEvent(val directionalInput: DirectionalInput, var sprint: Boolean, val source: Source) : Event() { + enum class Source { + INPUT, + MOVEMENT_TICK, + NETWORK } } diff --git a/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/ModuleSuperKnockback.kt b/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/ModuleSuperKnockback.kt index 3bdb9c1a918..a1585e2a2d7 100644 --- a/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/ModuleSuperKnockback.kt +++ b/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/ModuleSuperKnockback.kt @@ -114,7 +114,8 @@ object ModuleSuperKnockback : ClientModule("SuperKnockback", Category.COMBAT, al private val movementHandler = handler( priority = EventPriorityConvention.FIRST_PRIORITY ) { event -> - if (cancelSprint && event.source.key) { + if (cancelSprint && (event.source == SprintEvent.Source.MOVEMENT_TICK || + event.source == SprintEvent.Source.INPUT)) { event.sprint = false } } diff --git a/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/killaura/ModuleKillAura.kt b/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/killaura/ModuleKillAura.kt index 4afb64a1c6b..de057b73997 100644 --- a/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/killaura/ModuleKillAura.kt +++ b/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/killaura/ModuleKillAura.kt @@ -549,7 +549,8 @@ object ModuleKillAura : ClientModule("KillAura", Category.COMBAT) { @Suppress("unused") private val sprintHandler = handler { event -> - if (shouldBlockSprinting) { + if (shouldBlockSprinting && (event.source == SprintEvent.Source.MOVEMENT_TICK || + event.source == SprintEvent.Source.INPUT)) { event.sprint = false } } diff --git a/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/movement/ModuleSprint.kt b/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/movement/ModuleSprint.kt index 379f1fb928f..a705741a2a0 100644 --- a/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/movement/ModuleSprint.kt +++ b/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/movement/ModuleSprint.kt @@ -82,6 +82,10 @@ object ModuleSprint : ClientModule("Sprint", Category.MOVEMENT) { private val sprintHandler = handler( priority = EventPriorityConvention.FIRST_PRIORITY ) { event -> + if (!event.directionalInput.isMoving) { + return@handler + } + if (event.source == SprintEvent.Source.MOVEMENT_TICK || event.source == SprintEvent.Source.INPUT) { event.sprint = true }