level = $level; $this->random = $random; $this->index = mt_rand(0, count(TemporalGenerator::$levels) - 1); $this->world = new PocketChunkParser(); $this->world->loadRaw(gzinflate(gzinflate(base64_decode(TemporalGenerator::$levels[$this->index][4]))), ""); $this->world->loadMap(); $this->level->setSeed(TemporalGenerator::$levels[$this->index][0]); } public function generateChunk($chunkX, $chunkZ){ } public function populateChunk($chunkX, $chunkZ){ } public function populateLevel(){ for($Z = 0; $Z < 16; ++$Z){ for($X = 0; $X < 16; ++$X){ $chunk = array( 0 => "", 1 => "", 2 => "", 3 => "", 4 => "", 5 => "", 6 => "", 7 => "" ); for($z = 0; $z < 16; ++$z){ for($x = 0; $x < 16; ++$x){ $block = $this->world->getChunkColumn($X, $Z, $x, $z, 0); $meta = $this->world->getChunkColumn($X, $Z, $x, $z, 1); for($Y = 0; $Y < 8; ++$Y){ $chunk[$Y] .= substr($block, $Y << 4, 16); $chunk[$Y] .= substr($meta, $Y << 3, 8); $chunk[$Y] .= "\x00\x00\x00\x00\x00\x00\x00\x00"; } } } foreach($chunk as $Y => $data){ $this->level->setMiniChunk($X, $Z, $Y, $data); } } console("[NOTICE] Importing level ".ceil(($Z + 1)/0.16)."%"); } $this->level->save(true, true); $this->world->map = null; $this->world = null; } public function getSpawn(){ return new Vector3(TemporalGenerator::$levels[$this->index][1], TemporalGenerator::$levels[$this->index][2], TemporalGenerator::$levels[$this->index][3]); } }