public function placeObject(ChunkManager $level, $x, $y, $z, Random $random)
{
if ($this->leavesBottomY === -1 or $this->leavesMaxRadius === -1) {
$this->findRandomLeavesSize($random);
}
$level->setBlockIdAt($x, $y - 1, $z, Block::DIRT);
$leavesRadius = 0;
for ($yy = $this->totalHeight; $yy >= $this->leavesBottomY; --$yy) {
for ($xx = -$leavesRadius; $xx <= $leavesRadius; ++$xx) {
for ($zz = -$leavesRadius; $zz <= $leavesRadius; ++$zz) {
if (abs($xx) != $leavesRadius or abs($zz) != $leavesRadius or $leavesRadius <= 0) {
$level->setBlockIdAt($x + $xx, $y + $yy, $z + $zz, Block::LEAVES);
$level->setBlockDataAt($x + $xx, $y + $yy, $z + $zz, $this->type);
}
}
}
if ($leavesRadius > 0 and $yy === $y + $this->leavesBottomY + 1) {
--$leavesRadius;
} elseif ($leavesRadius < $this->leavesMaxRadius) {
++$leavesRadius;
}
}
for ($yy = 0; $yy < $this->totalHeight - 1; ++$yy) {
$level->setBlockIdAt($x, $y + $yy, $z, Block::TRUNK);
$level->setBlockDataAt($x, $y + $yy, $z, $this->type);
}
}