mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 10:49:10 +00:00
Fixed trees not generating trunk
This commit is contained in:
parent
e09ebb0623
commit
79adbdeafe
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user