From dc4c5d43e8191077654d595e73945db455f547ed Mon Sep 17 00:00:00 2001 From: izuna Date: Sat, 11 Jan 2025 05:52:50 +0100 Subject: [PATCH] fix(AutoBow): shooting bow flagging bad packet fixes https://github.com/CCBlueX/LiquidBounce/issues/5204 --- .../aimbot/autobow/AutoBowAutoShootFeature.kt | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/aimbot/autobow/AutoBowAutoShootFeature.kt b/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/aimbot/autobow/AutoBowAutoShootFeature.kt index 71479d28635..276a64b80d1 100644 --- a/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/aimbot/autobow/AutoBowAutoShootFeature.kt +++ b/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/aimbot/autobow/AutoBowAutoShootFeature.kt @@ -2,6 +2,7 @@ package net.ccbluex.liquidbounce.features.module.modules.combat.aimbot.autobow import net.ccbluex.liquidbounce.config.types.ToggleableConfigurable import net.ccbluex.liquidbounce.event.events.GameTickEvent +import net.ccbluex.liquidbounce.event.events.KeybindIsPressedEvent import net.ccbluex.liquidbounce.event.handler import net.ccbluex.liquidbounce.features.module.modules.combat.aimbot.ModuleAutoBow import net.ccbluex.liquidbounce.utils.aiming.RotationManager @@ -52,8 +53,12 @@ object AutoBowAutoShootFeature : ToggleableConfigurable(ModuleAutoBow, "AutoShoo return currentChargeRandom!! } + private var forceUncharged = false + @Suppress("unused") - val tickRepeatable = handler { + private val tickHandler = handler { + forceUncharged = false + val currentItem = player.activeItem?.item // Should check if player is using bow @@ -64,6 +69,7 @@ object AutoBowAutoShootFeature : ToggleableConfigurable(ModuleAutoBow, "AutoShoo if (player.itemUseTime < charged + getChargedRandom()) { // Wait until the bow is fully charged return@handler } + if (!ModuleAutoBow.lastShotTimer.hasElapsed((delayBetweenShots * 1000.0F).toLong())) { return@handler } @@ -88,10 +94,17 @@ object AutoBowAutoShootFeature : ToggleableConfigurable(ModuleAutoBow, "AutoShoo } } - interaction.stopUsingItem(player) + forceUncharged = true updateChargeRandom() } + @Suppress("unused") + private val keybindHandler = handler { event -> + if (event.keyBinding == mc.options.useKey && forceUncharged) { + event.isPressed = false + } + } + fun getHypotheticalHit(): AbstractClientPlayerEntity? { val rotation = RotationManager.serverRotation val yaw = rotation.yaw @@ -144,4 +157,10 @@ object AutoBowAutoShootFeature : ToggleableConfigurable(ModuleAutoBow, "AutoShoo Pair(it, PlayerSimulationCache.getSimulationForOtherPlayers(it)) } } + + override fun disable() { + forceUncharged = false + super.disable() + } + }