◆ __construct()
CaveNode constructor.
- Parameters
-
ChunkManager | $level | |
Vector3 | $chunk | |
Vector3 | $start | |
Vector3 | $end | |
Vector3 | $target | |
| $verticalSize | |
| $horizontalSize | |
233 $this->level = $level;
234 $this->chunk = $chunk;
235 $this->start = $this->clamp($start);
236 $this->end = $this->clamp($end);
237 $this->target = $target;
238 $this->verticalSize = $verticalSize;
239 $this->horizontalSize = $horizontalSize;
◆ canPlace()
- Returns
- bool
259 for($x = $this->start->getFloorX(); $x < $this->end->getFloorX(); $x++){
260 for($z = $this->start->getFloorZ(); $z < $this->end->getFloorZ(); $z++){
261 for($y = $this->end->getFloorY() + 1; $y >= $this->start->getFloorY() - 1; $y--){
262 $blockId = $this->level->getBlockIdAt($this->chunk->getX() + $x, $y, $this->chunk->getZ() + $z);
266 if($y != ($this->start->getFloorY() - 1) and $x != ($this->start->getFloorX()) and $x != ($this->end->getFloorX() - 1) and $z != ($this->start->getFloorZ()) and $z != ($this->end->getFloorZ() - 1)){
267 $y = $this->start->getFloorY();
◆ place()
276 for($x = $this->start->getFloorX(); $x < $this->end->getFloorX(); $x++){
277 $xOffset = ($this->chunk->getX() + $x + 0.5 - $this->target->getX()) / $this->horizontalSize;
278 for($z = $this->start->getFloorZ(); $z < $this->end->getFloorZ(); $z++){
279 $zOffset = ($this->chunk->getZ() + $z + 0.5 - $this->target->getZ()) / $this->horizontalSize;
280 if(($xOffset * $xOffset + $zOffset * $zOffset) >= 1){
283 for($y = $this->end->getFloorY() - 1; $y >= $this->start->getFloorY(); $y--){
284 $yOffset = ($y + 0.5 - $this->target->getY()) / $this->verticalSize;
285 if($yOffset > -0.7 and ($xOffset * $xOffset + $yOffset * $yOffset + $zOffset * $zOffset) < 1){
286 $xx = $this->chunk->getX() + $x;
287 $zz = $this->chunk->getZ() + $z;
288 $blockId = $this->level->getBlockIdAt($xx, $y, $zz);
294 $this->level->setBlockIdAt($xx, $y - 1, $zz,
Block::GRASS);
296 $this->level->setBlockIdAt($xx, $y, $zz,
Block::AIR);
The documentation for this class was generated from the following file:
- src/pocketmine/level/generator/populator/Cave.php