mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-13 15:05:33 +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,11 +3607,16 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
|
|
||||||
if($source->isCancelled()){
|
if($source->isCancelled()){
|
||||||
return;
|
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]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOffsetPosition(Vector3 $vector3) : Vector3{
|
public function getOffsetPosition(Vector3 $vector3) : Vector3{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user