Entity: clean up sendData() handling, remove send-to-self hack

This commit is contained in:
Dylan K. Taylor
2020-10-08 21:35:36 +01:00
parent 01b44ab0bc
commit b0b08d45d5
6 changed files with 21 additions and 24 deletions

View File

@ -2185,6 +2185,14 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
$properties->setBlockPos(EntityMetadataProperties::PLAYER_BED_POSITION, $this->sleeping ?? new Vector3(0, 0, 0));
}
public function sendData(?array $targets, ?array $data = null) : void{
if($targets === null){
$targets = $this->getViewers();
$targets[] = $this;
}
parent::sendData($targets, $data);
}
public function broadcastAnimation(Animation $animation, ?array $targets = null) : void{
if($this->spawned and $targets === null){
$targets = $this->getViewers();