mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Player: broadcast entity event to self as well when sending to all viewers
this fixes several bugs with entity events and removes the need for a hit animation hack.
This commit is contained in:
parent
faa88a55e4
commit
1c4dd4f280
@ -3706,11 +3706,12 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
parent::attack($source);
|
||||
}
|
||||
|
||||
protected function doHitAnimation() : void{
|
||||
parent::doHitAnimation();
|
||||
if($this->spawned){
|
||||
$this->broadcastEntityEvent(EntityEventPacket::HURT_ANIMATION, null, [$this]);
|
||||
public function broadcastEntityEvent(int $eventId, ?int $eventData = null, ?array $players = null) : void{
|
||||
if($this->spawned and $players === null){
|
||||
$players = $this->getViewers();
|
||||
$players[] = $this;
|
||||
}
|
||||
parent::broadcastEntityEvent($eventId, $eventData, $players);
|
||||
}
|
||||
|
||||
public function getOffsetPosition(Vector3 $vector3) : Vector3{
|
||||
|
Loading…
x
Reference in New Issue
Block a user