mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 01:09:44 +00:00
World: rename chunkPackets -> packetBuffersByChunk
This commit is contained in:
parent
bd3bf3d0ce
commit
a05b1fec7e
@ -173,7 +173,7 @@ class World implements ChunkManager{
|
|||||||
private $playerChunkListeners = [];
|
private $playerChunkListeners = [];
|
||||||
|
|
||||||
/** @var ClientboundPacket[][] */
|
/** @var ClientboundPacket[][] */
|
||||||
private $chunkPackets = [];
|
private $packetBuffersByChunk = [];
|
||||||
|
|
||||||
/** @var float[] */
|
/** @var float[] */
|
||||||
private $unloadQueue = [];
|
private $unloadQueue = [];
|
||||||
@ -525,10 +525,10 @@ class World implements ChunkManager{
|
|||||||
* Broadcasts a packet to every player who has the target position within their view distance.
|
* Broadcasts a packet to every player who has the target position within their view distance.
|
||||||
*/
|
*/
|
||||||
public function broadcastPacketToViewers(Vector3 $pos, ClientboundPacket $packet) : void{
|
public function broadcastPacketToViewers(Vector3 $pos, ClientboundPacket $packet) : void{
|
||||||
if(!isset($this->chunkPackets[$index = World::chunkHash($pos->getFloorX() >> 4, $pos->getFloorZ() >> 4)])){
|
if(!isset($this->packetBuffersByChunk[$index = World::chunkHash($pos->getFloorX() >> 4, $pos->getFloorZ() >> 4)])){
|
||||||
$this->chunkPackets[$index] = [$packet];
|
$this->packetBuffersByChunk[$index] = [$packet];
|
||||||
}else{
|
}else{
|
||||||
$this->chunkPackets[$index][] = $packet;
|
$this->packetBuffersByChunk[$index][] = $packet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -776,7 +776,7 @@ class World implements ChunkManager{
|
|||||||
$this->checkSleep();
|
$this->checkSleep();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($this->chunkPackets as $index => $entries){
|
foreach($this->packetBuffersByChunk as $index => $entries){
|
||||||
World::getXZ($index, $chunkX, $chunkZ);
|
World::getXZ($index, $chunkX, $chunkZ);
|
||||||
$chunkPlayers = $this->getChunkPlayers($chunkX, $chunkZ);
|
$chunkPlayers = $this->getChunkPlayers($chunkX, $chunkZ);
|
||||||
if(count($chunkPlayers) > 0){
|
if(count($chunkPlayers) > 0){
|
||||||
@ -784,7 +784,7 @@ class World implements ChunkManager{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->chunkPackets = [];
|
$this->packetBuffersByChunk = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkSleep() : void{
|
public function checkSleep() : void{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user