Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(AutoBow): shooting bow flagging bad packet #5264

Merged
merged 1 commit into from
Jan 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -52,8 +53,12 @@ object AutoBowAutoShootFeature : ToggleableConfigurable(ModuleAutoBow, "AutoShoo
return currentChargeRandom!!
}

private var forceUncharged = false

@Suppress("unused")
val tickRepeatable = handler<GameTickEvent> {
private val tickHandler = handler<GameTickEvent> {
forceUncharged = false

val currentItem = player.activeItem?.item

// Should check if player is using bow
Expand All @@ -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
}
Expand All @@ -88,10 +94,17 @@ object AutoBowAutoShootFeature : ToggleableConfigurable(ModuleAutoBow, "AutoShoo
}
}

interaction.stopUsingItem(player)
forceUncharged = true
updateChargeRandom()
}

@Suppress("unused")
private val keybindHandler = handler<KeybindIsPressedEvent> { event ->
if (event.keyBinding == mc.options.useKey && forceUncharged) {
event.isPressed = false
}
}

fun getHypotheticalHit(): AbstractClientPlayerEntity? {
val rotation = RotationManager.serverRotation
val yaw = rotation.yaw
Expand Down Expand Up @@ -144,4 +157,10 @@ object AutoBowAutoShootFeature : ToggleableConfigurable(ModuleAutoBow, "AutoShoo
Pair(it, PlayerSimulationCache.getSimulationForOtherPlayers(it))
}
}

override fun disable() {
forceUncharged = false
super.disable()
}

}
Loading