Player: Added animation to missSwing() (#5942)

This commit is contained in:
rasu3n 2023-07-26 18:04:36 +09:00 committed by GitHub
parent 6086ef667c
commit bbdcab7277
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1897,13 +1897,14 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
/** /**
* Performs actions associated with the attack action (left-click) without a target entity. * Performs actions associated with the attack action (left-click) without a target entity.
* Under normal circumstances, this will play the no-damage attack sound and nothing else. * Under normal circumstances, this will just play the no-damage attack sound and the arm-swing animation.
*/ */
public function missSwing() : void{ public function missSwing() : void{
$ev = new PlayerMissedSwingEvent($this); $ev = new PlayerMissedSwingEvent($this);
$ev->call(); $ev->call();
if(!$ev->isCancelled()){ if(!$ev->isCancelled()){
$this->broadcastSound(new EntityAttackNoDamageSound()); $this->broadcastSound(new EntityAttackNoDamageSound());
$this->broadcastAnimation(new ArmSwingAnimation($this), $this->getViewers());
} }
} }