From 94ef48d9f2e362167c077b9584e42ed2c71d679f Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 6 Oct 2023 16:08:19 -0500 Subject: make sure pathfinder is always centered on the destination block (fixes tests) --- azalea-client/src/attack.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'azalea-client/src/attack.rs') diff --git a/azalea-client/src/attack.rs b/azalea-client/src/attack.rs index ca2ff312..644af5de 100644 --- a/azalea-client/src/attack.rs +++ b/azalea-client/src/attack.rs @@ -53,7 +53,13 @@ impl Client { /// Whether the player has an attack cooldown. pub fn has_attack_cooldown(&self) -> bool { - let ticks_since_last_attack = *self.component::(); + let Some(AttackStrengthScale(ticks_since_last_attack)) = + self.get_component::() + else { + // they don't even have an AttackStrengthScale so they probably can't attack + // lmao, just return false + return false; + }; ticks_since_last_attack < 1.0 } } -- cgit v1.2.3