public function populateChunk($chunkX, $chunkZ) { if (!$this->isChunkGenerated($chunkX, $chunkZ)) { $this->generateChunk($chunkX, $chunkZ); } for ($z = $chunkZ - 1; $z <= $chunkZ + 1; ++$z) { for ($x = $chunkX - 1; $x <= $chunkX + 1; ++$x) { if (!$this->isChunkGenerated($x, $z)) { $this->generateChunk($x, $z); } } } $this->generator->populateChunk($chunkX, $chunkZ); $this->setChunkPopulated($chunkX, $chunkZ); }