From aac017eae4e41bfd91d1aef32c41eb792963ef92 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 4 May 2020 10:22:39 +0100 Subject: [PATCH] World: drop unused and very misleadingly named addChunkPacket() --- src/world/World.php | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/world/World.php b/src/world/World.php index 24a063f9d..e1caee8cb 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -514,24 +514,16 @@ class World implements ChunkManager{ } /** - * Queues a packet to be sent to all players using the chunk at the specified X/Z coordinates at the end of the - * current tick. + * Broadcasts a packet to every player who has the target position within their view distance. */ - public function addChunkPacket(int $chunkX, int $chunkZ, ClientboundPacket $packet) : void{ - if(!isset($this->chunkPackets[$index = World::chunkHash($chunkX, $chunkZ)])){ + public function broadcastPacketToViewers(Vector3 $pos, ClientboundPacket $packet) : void{ + if(!isset($this->chunkPackets[$index = World::chunkHash($pos->getFloorX() >> 4, $pos->getFloorZ() >> 4)])){ $this->chunkPackets[$index] = [$packet]; }else{ $this->chunkPackets[$index][] = $packet; } } - /** - * Broadcasts a packet to every player who has the target position within their view distance. - */ - public function broadcastPacketToViewers(Vector3 $pos, ClientboundPacket $packet) : void{ - $this->addChunkPacket($pos->getFloorX() >> 4, $pos->getFloorZ() >> 4, $packet); - } - public function registerChunkLoader(ChunkLoader $loader, int $chunkX, int $chunkZ, bool $autoLoad = true) : void{ $loaderId = spl_object_id($loader);