Player: fixed arm swing animation not showing during attack cooldown of victim

closes #4650
This commit is contained in:
Dylan K. Taylor 2021-12-14 19:03:42 +00:00
parent 4ad8cb02a5
commit 45c4a9673d
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -1667,13 +1667,13 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
} }
$entity->attack($ev); $entity->attack($ev);
$this->broadcastAnimation(new ArmSwingAnimation($this), $this->getViewers());
$soundPos = $entity->getPosition()->add(0, $entity->size->getHeight() / 2, 0); $soundPos = $entity->getPosition()->add(0, $entity->size->getHeight() / 2, 0);
if($ev->isCancelled()){ if($ev->isCancelled()){
$this->getWorld()->addSound($soundPos, new EntityAttackNoDamageSound()); $this->getWorld()->addSound($soundPos, new EntityAttackNoDamageSound());
return false; return false;
} }
$this->broadcastAnimation(new ArmSwingAnimation($this), $this->getViewers());
$this->getWorld()->addSound($soundPos, new EntityAttackSound()); $this->getWorld()->addSound($soundPos, new EntityAttackSound());
if($ev->getModifier(EntityDamageEvent::MODIFIER_CRITICAL) > 0 and $entity instanceof Living){ if($ev->getModifier(EntityDamageEvent::MODIFIER_CRITICAL) > 0 and $entity instanceof Living){