34 public function __construct(){
35 parent::__construct(VanillaBlocks::SPRUCE_LOG(), VanillaBlocks::SPRUCE_LEAVES(), 10);
38 protected function generateTrunkHeight(
Random $random) :
int{
39 return $this->treeHeight - $random->nextBoundedInt(3);
43 $this->treeHeight = $random->nextBoundedInt(4) + 6;
44 return parent::getBlockTransaction($world, $x, $y, $z, $random);
47 protected function placeCanopy(
int $x,
int $y,
int $z,
Random $random,
BlockTransaction $transaction) : void{
48 $topSize = $this->treeHeight - (1 + $random->nextBoundedInt(2));
49 $lRadius = 2 + $random->nextBoundedInt(2);
50 $radius = $random->nextBoundedInt(2);
54 for($yy = 0; $yy <= $topSize; ++$yy){
55 $yyy = $y + $this->treeHeight - $yy;
57 for($xx = $x - $radius; $xx <= $x + $radius; ++$xx){
58 $xOff = abs($xx - $x);
59 for($zz = $z - $radius; $zz <= $z + $radius; ++$zz){
60 $zOff = abs($zz - $z);
61 if($xOff === $radius && $zOff === $radius && $radius > 0){
65 if(!$transaction->
fetchBlockAt($xx, $yyy, $zz)->isSolid()){
66 $transaction->
addBlockAt($xx, $yyy, $zz, $this->leafBlock);
74 if(++$maxR > $lRadius){