mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-23 00:55:57 +00:00
Player: Cleaned up how hurt animations are handled
Override Living->doHitAnimation() instead to ensure that the animation always gets sent to the player.
This commit is contained in:
parent
532600ab67
commit
3f50f88e2c
@ -3607,10 +3607,15 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
|
||||
if($source->isCancelled()){
|
||||
return;
|
||||
}elseif($this->getLastDamageCause() === $source and $this->spawned){
|
||||
$this->broadcastEntityEvent(EntityEventPacket::HURT_ANIMATION, null, [$this]);
|
||||
}
|
||||
|
||||
$this->exhaust(0.3, PlayerExhaustEvent::CAUSE_DAMAGE);
|
||||
$this->exhaust(0.3, PlayerExhaustEvent::CAUSE_DAMAGE);
|
||||
}
|
||||
|
||||
protected function doHitAnimation() : void{
|
||||
parent::doHitAnimation();
|
||||
if($this->spawned){
|
||||
$this->broadcastEntityEvent(EntityEventPacket::HURT_ANIMATION, null, [$this]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user