Fixed trees not generating trunk

This commit is contained in:
Shoghi Cervantes 2015-04-15 11:04:00 +02:00
parent e09ebb0623
commit 79adbdeafe
2 changed files with 6 additions and 6 deletions

View File

@ -51,10 +51,10 @@ class SpruceTree extends Tree{
$yyy = $y + $this->treeHeight - $yy; $yyy = $y + $this->treeHeight - $yy;
for($xx = $x - $radius; $xx <= $x + $radius; ++$xx){ for($xx = $x - $radius; $xx <= $x + $radius; ++$xx){
$xOff = $xx - $x; $xOff = abs($xx - $x);
for($zz = $z - $radius; $zz <= $z + $radius; ++$zz){ for($zz = $z - $radius; $zz <= $z + $radius; ++$zz){
$zOff = $zz - $z; $zOff = abs($zz - $z);
if(abs($xOff) === $radius and abs($zOff) === $radius and $radius > 0){ if(($xOff === 0 and $zOff === 0) or ($xOff === $radius and $zOff === $radius and $radius > 0)){
continue; continue;
} }

View File

@ -99,10 +99,10 @@ abstract class Tree{
$yOff = $yy - ($y + $this->treeHeight); $yOff = $yy - ($y + $this->treeHeight);
$mid = (int) (1 - $yOff / 2); $mid = (int) (1 - $yOff / 2);
for($xx = $x - $mid; $xx <= $x + $mid; ++$xx){ for($xx = $x - $mid; $xx <= $x + $mid; ++$xx){
$xOff = $xx - $x; $xOff = abs($xx - $x);
for($zz = $z - $mid; $zz <= $z + $mid; ++$zz){ for($zz = $z - $mid; $zz <= $z + $mid; ++$zz){
$zOff = $zz - $z; $zOff = abs($zz - $z);
if(abs($xOff) === $mid and abs($zOff) === $mid and ($yOff === 0 or $random->nextBoundedInt(2) === 0)){ if(($xOff === 0 and $zOff === 0) or ($xOff === $mid and $zOff === $mid and ($yOff === 0 or $random->nextBoundedInt(2) === 0))){
continue; continue;
} }
$level->setBlockIdAt($xx, $yy, $zz, $this->leafBlock); $level->setBlockIdAt($xx, $yy, $zz, $this->leafBlock);