pocketmine\Player::sendNextChunk PHP Method

sendNextChunk() protected method

protected sendNextChunk ( )
    protected function sendNextChunk()
    {
        if ($this->connected === false) {
            return;
        }
        Timings::$playerChunkSendTimer->startTiming();
        $count = 0;
        foreach ($this->loadQueue as $index => $distance) {
            if ($count >= $this->chunksPerTick) {
                break;
            }
            $X = null;
            $Z = null;
            Level::getXZ($index, $X, $Z);
            ++$count;
            $this->usedChunks[$index] = false;
            $this->level->registerChunkLoader($this, $X, $Z, true);
            if (!$this->level->populateChunk($X, $Z)) {
                if ($this->spawned and $this->teleportPosition === null) {
                    continue;
                } else {
                    break;
                }
            }
            unset($this->loadQueue[$index]);
            $this->level->requestChunk($X, $Z, $this);
            if (count($this->loadQueue) == 0 and $this->shouldSendStatus) {
                $this->shouldSendStatus = false;
                $pk = new PlayStatusPacket();
                $pk->status = PlayStatusPacket::PLAYER_SPAWN;
                $this->dataPacket($pk);
                /*$pk = new RespawnPacket();
                		$pk->x = $this->x;
                		$pk->y = $this->y;
                		$pk->z = $this->z;
                		$this->dataPacket($pk);*/
            }
        }
        if ($this->chunkLoadCount >= $this->spawnThreshold and $this->spawned === false and $this->teleportPosition === null) {
            $this->doFirstSpawn();
        }
        Timings::$playerChunkSendTimer->stopTiming();
    }
Player