LiquidBounce
LiquidBounce copied to clipboard
feat(combat): implement 1.8 block priority and void knockback priority in AutoWeapon
This pull request introduces two new PvP priority mechanics to the AutoWeapon module:
1. 1.8 Block Priority
- Prioritizes swords during legacy PvP/1.8 combat when KillAura's AutoBlock is configured to block 'Only When in Danger' and we are actively in danger.
- Exposes
isOnlyWhenInDangervia a clean property accessor instead of coupling to configuration internals.
2. Void Knockback Priority
- Automatically prioritizes weapons or items with the highest Knockback enchantment level (e.g. knockback sticks) if the target is standing close to the void and the knockback direction will push them off.
- Fully addresses Copilot's review and performance comments:
- Uses floor-based coordinate mapping (
floor(checkX).toInt()) instead of truncation (toInt()) to prevent coordinate shift on negative values. - Avoids allocations and high RNG lookup counts by making check distances a static constant and early exiting once the threshold is achieved.
- Caches
isNearVoidresults per tick per target entity, resulting in zero overhead on subsequent calls.
- Uses floor-based coordinate mapping (