◆ canPlaceObject()
- Parameters
-
- Returns
- bool
102 for($yy = 0; $yy < $this->treeHeight + 3; ++$yy){
103 if($yy == 1 or $yy === $this->treeHeight){
106 for($xx = -$radiusToCheck; $xx < ($radiusToCheck + 1); ++$xx){
107 for($zz = -$radiusToCheck; $zz < ($radiusToCheck + 1); ++$zz){
108 if(!isset($this->overridable[$level->getBlockIdAt($x + $xx, $y + $yy, $z + $zz)])){
◆ growTree()
static growTree |
( |
ChunkManager |
$level, |
|
|
|
$x, |
|
|
|
$y, |
|
|
|
$z, |
|
|
Random |
$random, |
|
|
|
$type = 0 , |
|
|
bool |
$noBigTree = true |
|
) |
| |
|
static |
- Parameters
-
ChunkManager | $level | |
| $x | |
| $y | |
| $z | |
Random | $random | |
int | $type | |
bool | $noBigTree | |
58 $tree =
new SpruceTree();
61 if($random->nextBoundedInt(39) === 0){
62 $tree =
new BirchTree(
true);
64 $tree =
new BirchTree();
68 $tree =
new JungleTree();
71 $tree =
new AcaciaTree();
74 $tree =
new DarkOakTree();
78 if(!$noBigTree and $random->nextRange(0, 9) === 0){
79 $tree =
new BigTree();
81 $tree =
new OakTree();
85 if($tree->canPlaceObject($level, $x, $y, $z, $random)){
86 $tree->placeObject($level, $x, $y, $z, $random);
◆ placeObject()
- Parameters
-
127 $this->
placeTrunk($level, $x, $y, $z, $random, $this->treeHeight - 1);
131 $mid = (int) (1 - $yOff / 2);
132 for($xx = $x - $mid; $xx <= $x + $mid; ++$xx){
133 $xOff = abs($xx - $x);
134 for($zz = $z - $mid; $zz <= $z + $mid; ++$zz){
135 $zOff = abs($zz - $z);
136 if($xOff === $mid and $zOff === $mid and ($yOff === 0 or $random->nextBoundedInt(2) === 0)){
140 $level->setBlockIdAt($xx, $yy, $zz, $this->leafBlock);
141 $level->setBlockDataAt($xx, $yy, $zz, $this->leafType);
◆ placeTrunk()
- Parameters
-
160 for($yy = 0; $yy < $trunkHeight; ++$yy){
161 $blockId = $level->getBlockIdAt($x, $y + $yy, $z);
162 if(isset($this->overridable[$blockId])){
163 $level->setBlockIdAt($x, $y + $yy, $z, $this->trunkBlock);
164 $level->setBlockDataAt($x, $y + $yy, $z, $this->type);
◆ $leafBlock
◆ $leafType
◆ $overridable
◆ $treeHeight
◆ $trunkBlock
◆ $type
The documentation for this class was generated from the following file:
- src/pocketmine/level/generator/object/Tree.php