mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 08:49:42 +00:00
World: added private broadcastPacketToPlayersUsingChunk()
this is equivalent to the old addChunkPacket, but private and with a less stupid name.
This commit is contained in:
parent
a05b1fec7e
commit
ca9f3020b4
@ -525,7 +525,11 @@ class World implements ChunkManager{
|
||||
* Broadcasts a packet to every player who has the target position within their view distance.
|
||||
*/
|
||||
public function broadcastPacketToViewers(Vector3 $pos, ClientboundPacket $packet) : void{
|
||||
if(!isset($this->packetBuffersByChunk[$index = World::chunkHash($pos->getFloorX() >> 4, $pos->getFloorZ() >> 4)])){
|
||||
$this->broadcastPacketToPlayersUsingChunk($pos->getFloorX() >> 4, $pos->getFloorZ() >> 4, $packet);
|
||||
}
|
||||
|
||||
private function broadcastPacketToPlayersUsingChunk(int $chunkX, int $chunkZ, ClientboundPacket $packet) : void{
|
||||
if(!isset($this->packetBuffersByChunk[$index = World::chunkHash($chunkX, $chunkZ)])){
|
||||
$this->packetBuffersByChunk[$index] = [$packet];
|
||||
}else{
|
||||
$this->packetBuffersByChunk[$index][] = $packet;
|
||||
|
Loading…
x
Reference in New Issue
Block a user