diff options
Diffstat (limited to 'azalea-client/src/attack.rs')
| -rw-r--r-- | azalea-client/src/attack.rs | 8 |
1 files changed, 7 insertions, 1 deletions
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::<AttackStrengthScale>(); + let Some(AttackStrengthScale(ticks_since_last_attack)) = + self.get_component::<AttackStrengthScale>() + 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 } } |
