pocketmine\level\format\mcregion\Chunk::toFastBinary PHP Метод

toFastBinary() публичный Метод

public toFastBinary ( )
    public function toFastBinary()
    {
        return Binary::writeInt($this->x) . Binary::writeInt($this->z) . $this->getBlockIdArray() . $this->getBlockDataArray() . $this->getBlockSkyLightArray() . $this->getBlockLightArray() . pack("C*", ...$this->getHeightMapArray()) . pack("N*", ...$this->getBiomeColorArray()) . chr(($this->isLightPopulated() ? 1 << 2 : 0) + ($this->isPopulated() ? 1 << 1 : 0) + ($this->isGenerated() ? 1 : 0));
    }

Usage Example

Пример #1
0
 public function __construct(Level $level, Chunk $chunk)
 {
     $this->levelId = $level->getId();
     $this->chunk = $chunk->toFastBinary();
     $this->chunkX = $chunk->getX();
     $this->chunkZ = $chunk->getZ();
     $tiles = "";
     $nbt = new NBT(NBT::LITTLE_ENDIAN);
     foreach ($chunk->getTiles() as $tile) {
         if ($tile instanceof Spawnable) {
             $nbt->setData($tile->getSpawnCompound());
             $tiles .= $nbt->write();
         }
     }
     $this->tiles = $tiles;
 }