pocketmine\level\format\LevelProvider::getLoadedChunks PHP Method

getLoadedChunks() public method

public getLoadedChunks ( ) : pocketmine\level\format\FullChunk | pocketmine\level\format\Chunk[]
return pocketmine\level\format\FullChunk | pocketmine\level\format\Chunk[]
    public function getLoadedChunks();

Usage Example

Example #1
0
 public function doChunkGarbageCollection()
 {
     $this->timings->doChunkGC->startTiming();
     $X = null;
     $Z = null;
     foreach ($this->chunks as $index => $chunk) {
         if (!isset($this->unloadQueue[$index]) and (!isset($this->usedChunks[$index]) or count($this->usedChunks[$index]) === 0)) {
             if (PHP_INT_SIZE === 8) {
                 $X = $index >> 32 << 32 >> 32;
                 $Z = ($index & 4294967295.0) << 32 >> 32;
             } else {
                 list($X, $Z) = explode(":", $index);
                 $X = (int) $X;
                 $Z = (int) $Z;
             }
             if (!$this->isSpawnChunk($X, $Z)) {
                 $this->unloadChunkRequest($X, $Z, true);
             }
         }
     }
     foreach ($this->provider->getLoadedChunks() as $chunk) {
         if (!isset($this->chunks[PHP_INT_SIZE === 8 ? ($chunk->getX() & 4294967295.0) << 32 | $chunk->getZ() & 4294967295.0 : $chunk->getX() . ":" . $chunk->getZ()])) {
             $this->provider->unloadChunk($chunk->getX(), $chunk->getZ(), false);
         }
     }
     $this->provider->doGarbageCollection();
     $this->timings->doChunkGC->stopTiming();
 }
All Usage Examples Of pocketmine\level\format\LevelProvider::getLoadedChunks