LiquidBounce icon indicating copy to clipboard operation
LiquidBounce copied to clipboard

feat(combat): implement 1.8 block priority and void knockback priority in AutoWeapon

Open m1trenv0 opened this issue 6 months ago • 0 comments

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 isOnlyWhenInDanger via 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 isNearVoid results per tick per target entity, resulting in zero overhead on subsequent calls.

m1trenv0 avatar Jun 01 '26 14:06 m1trenv0