public function generateChunk($chunkX, $chunkZ)
{
$shape = $this->getShape($chunkX << 4, $chunkZ << 4);
$chunk = $this->level->getChunk($chunkX, $chunkZ);
$chunk->setGenerated();
$c = Biome::getBiome(1)->getColor();
$R = $c >> 16;
$G = $c >> 8 & 0xff;
$B = $c & 0xff;
$bottomBlockId = $this->bottomBlock->getId();
$bottomBlockMeta = $this->bottomBlock->getDamage();
$plotFillBlockId = $this->plotFillBlock->getId();
$plotFillBlockMeta = $this->plotFillBlock->getDamage();
$plotFloorBlockId = $this->plotFloorBlock->getId();
$plotFloorBlockMeta = $this->plotFloorBlock->getDamage();
$roadBlockId = $this->roadBlock->getId();
$roadBlockMeta = $this->roadBlock->getDamage();
$wallBlockId = $this->wallBlock->getId();
$wallBlockMeta = $this->wallBlock->getDamage();
$groundHeight = $this->groundHeight;
for ($Z = 0; $Z < 16; ++$Z) {
for ($X = 0; $X < 16; ++$X) {
$chunk->setBiomeId($X, $Z, 1);
$chunk->setBiomeColor($X, $Z, $R, $G, $B);
$chunk->setBlock($X, 0, $Z, $bottomBlockId, $bottomBlockMeta);
for ($y = 1; $y < $groundHeight; ++$y) {
$chunk->setBlock($X, $y, $Z, $plotFillBlockId, $plotFillBlockMeta);
}
$type = $shape[$Z << 4 | $X];
if ($type === self::PLOT) {
$chunk->setBlock($X, $groundHeight, $Z, $plotFloorBlockId, $plotFloorBlockMeta);
} elseif ($type === self::ROAD) {
$chunk->setBlock($X, $groundHeight, $Z, $roadBlockId, $roadBlockMeta);
} else {
$chunk->setBlock($X, $groundHeight, $Z, $roadBlockId, $roadBlockMeta);
$chunk->setBlock($X, $groundHeight + 1, $Z, $wallBlockId, $wallBlockMeta);
}
}
}
$chunk->setX($chunkX);
$chunk->setZ($chunkZ);
$this->level->setChunk($chunkX, $chunkZ, $chunk);
}