public static fromFastBinary ( string $data, pocketmine\level\format\LevelProvider $provider = null ) : |
||
$data | string | |
$provider | pocketmine\level\format\LevelProvider | |
Результат |
public function onRun() { $chunk = Chunk::fromFastBinary($this->chunk); $extraData = new BinaryStream(); $extraData->putLInt(count($chunk->getBlockExtraDataArray())); foreach ($chunk->getBlockExtraDataArray() as $key => $value) { $extraData->putLInt($key); $extraData->putLShort($value); } $ordered = $chunk->getBlockIdArray() . $chunk->getBlockDataArray() . $chunk->getBlockSkyLightArray() . $chunk->getBlockLightArray() . pack("C*", ...$chunk->getHeightMapArray()) . pack("N*", ...$chunk->getBiomeColorArray()) . $extraData->getBuffer() . $this->tiles; $this->setResult($ordered, false); }
public function onRun() { $chunk = Chunk::fromFastBinary($this->chunk); $ids = $chunk->getBlockIdArray(); $meta = $chunk->getBlockDataArray(); $blockLight = $chunk->getBlockLightArray(); $skyLight = $chunk->getBlockSkyLightArray(); $orderedIds = ""; $orderedData = ""; $orderedSkyLight = ""; $orderedLight = ""; for ($x = 0; $x < 16; ++$x) { for ($z = 0; $z < 16; ++$z) { $orderedIds .= $this->getColumn($ids, $x, $z); $orderedData .= $this->getHalfColumn($meta, $x, $z); $orderedSkyLight .= $this->getHalfColumn($skyLight, $x, $z); $orderedLight .= $this->getHalfColumn($blockLight, $x, $z); } } $biomeColors = pack("N*", ...$chunk->getBiomeColorArray()); $ordered = $orderedIds . $orderedData . $orderedSkyLight . $orderedLight . $chunk->getBiomeIdArray() . $biomeColors . $this->tiles; $this->setResult($ordered, false); }