mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-17 03:08:58 +00:00
Fixed long trunk generation
This commit is contained in:
parent
7f28deefcb
commit
fc2e4ddc63
@ -54,14 +54,16 @@ class SpruceTree extends Tree{
|
|||||||
$xOff = abs($xx - $x);
|
$xOff = abs($xx - $x);
|
||||||
for($zz = $z - $radius; $zz <= $z + $radius; ++$zz){
|
for($zz = $z - $radius; $zz <= $z + $radius; ++$zz){
|
||||||
$zOff = abs($zz - $z);
|
$zOff = abs($zz - $z);
|
||||||
if(($xOff === 0 and $zOff === 0) or ($xOff === $radius and $zOff === $radius and $radius > 0)){
|
if($xOff === $radius and $zOff === $radius and $radius > 0){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!Block::$solid[$level->getBlockIdAt($xx, $yyy, $zz)]){
|
||||||
$level->setBlockIdAt($xx, $yyy, $zz, $this->leafBlock);
|
$level->setBlockIdAt($xx, $yyy, $zz, $this->leafBlock);
|
||||||
$level->setBlockDataAt($xx, $yyy, $zz, $this->type);
|
$level->setBlockDataAt($xx, $yyy, $zz, $this->type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($radius >= $maxR){
|
if($radius >= $maxR){
|
||||||
$radius = $minR;
|
$radius = $minR;
|
||||||
|
@ -102,21 +102,23 @@ abstract class Tree{
|
|||||||
$xOff = abs($xx - $x);
|
$xOff = abs($xx - $x);
|
||||||
for($zz = $z - $mid; $zz <= $z + $mid; ++$zz){
|
for($zz = $z - $mid; $zz <= $z + $mid; ++$zz){
|
||||||
$zOff = abs($zz - $z);
|
$zOff = abs($zz - $z);
|
||||||
if(($xOff === 0 and $zOff === 0) or ($xOff === $mid and $zOff === $mid and ($yOff === 0 or $random->nextBoundedInt(2) === 0))){
|
if($xOff === $mid and $zOff === $mid and ($yOff === 0 or $random->nextBoundedInt(2) === 0)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if(!Block::$solid[$level->getBlockIdAt($xx, $yy, $zz)]){
|
||||||
$level->setBlockIdAt($xx, $yy, $zz, $this->leafBlock);
|
$level->setBlockIdAt($xx, $yy, $zz, $this->leafBlock);
|
||||||
$level->setBlockDataAt($xx, $yy, $zz, $this->type);
|
$level->setBlockDataAt($xx, $yy, $zz, $this->type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function placeTrunk(ChunkManager $level, $x, $y, $z, Random $random, $trunkHeight){
|
protected function placeTrunk(ChunkManager $level, $x, $y, $z, Random $random, $trunkHeight){
|
||||||
// The base dirt block
|
// The base dirt block
|
||||||
$level->setBlockIdAt($x, $y - 1, $z, Block::DIRT);
|
$level->setBlockIdAt($x, $y - 1, $z, Block::DIRT);
|
||||||
|
|
||||||
for($yy = 0; $yy <= $trunkHeight; ++$yy){
|
for($yy = 0; $yy < $trunkHeight; ++$yy){
|
||||||
$blockId = $level->getBlockIdAt($x, $y + $yy, $z);
|
$blockId = $level->getBlockIdAt($x, $y + $yy, $z);
|
||||||
if(isset($this->overridable[$blockId])){
|
if(isset($this->overridable[$blockId])){
|
||||||
$level->setBlockIdAt($x, $y + $yy, $z, $this->trunkBlock);
|
$level->setBlockIdAt($x, $y + $yy, $z, $this->trunkBlock);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user