diff options
| author | mat <git@matdoes.dev> | 2023-10-06 16:08:19 -0500 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2023-10-06 16:08:26 -0500 |
| commit | 94ef48d9f2e362167c077b9584e42ed2c71d679f (patch) | |
| tree | 1670cbdc946ce9574f20f6ed6a49e061394bf602 /azalea-client/src/attack.rs | |
| parent | 30702d94f65a2bd86c9ac0a7c402675b89ac4364 (diff) | |
| download | azalea-drasl-94ef48d9f2e362167c077b9584e42ed2c71d679f.tar.xz | |
make sure pathfinder is always centered on the destination block (fixes tests)
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 } } |
