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:
Dylan K. Taylor 2017-12-14 11:34:09 +00:00
parent 532600ab67
commit 3f50f88e2c

View File

@ -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{