Example #1
0
 /**
  * @param      $chunkX
  * @param      $chunkZ
  *
  * @return Chunk
  */
 private function readChunk($chunkX, $chunkZ)
 {
     $index = LevelDB::chunkIndex($chunkX, $chunkZ);
     if (!$this->chunkExists($chunkX, $chunkZ) or ($data = $this->db->get($index . self::ENTRY_TERRAIN)) === false) {
         return null;
     }
     $flags = $this->db->get($index . self::ENTRY_FLAGS);
     if ($flags === false) {
         $flags = "";
     }
     return Chunk::fromBinary($index . $data . $flags, $this);
 }
Example #2
0
 protected function unserializeChunk($data)
 {
     return Chunk::fromBinary($data, $this->levelProvider);
 }