Level: Added API method broadcastPacketToViewers()

This supersedes addChunkPacket() in most cases, and has a more clear name. It broadcasts the given packet to every player who has the target position within their chunk load radius.
This commit is contained in:
Dylan K. Taylor
2018-10-20 15:14:41 +01:00
parent 7c44eea625
commit d563b9e31b
6 changed files with 35 additions and 32 deletions

View File

@ -67,8 +67,7 @@ abstract class Spawnable extends Tile{
return;
}
$pk = $this->createSpawnPacket();
$this->level->addChunkPacket($this->getFloorX() >> 4, $this->getFloorZ() >> 4, $pk);
$this->level->broadcastPacketToViewers($this, $this->createSpawnPacket());
}
/**