PocketMine-MP  1.4 - API 1.10.0
 All Classes Namespaces Functions Variables Pages
BigTree.php
1 <?php
2 
3 /*
4  *
5  * ____ _ _ __ __ _ __ __ ____
6  * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
7  * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
8  * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
9  * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * @author PocketMine Team
17  * @link http://www.pocketmine.net/
18  *
19  *
20 */
21 
22 namespace pocketmine\level\generator\object;
23 
25 
26 class BigTree extends Tree{
27  private $trunkHeightMultiplier = 0.618;
28  private $trunkHeight;
29  private $leafAmount = 1;
30  private $leafDistanceLimit = 5;
31  private $widthScale = 1;
32  private $branchSlope = 0.381;
33 
34  private $totalHeight = 6;
35  private $leavesHeight = 3;
36  protected $radiusIncrease = 0;
37  private $addLeavesVines = false;
38  private $addLogVines = false;
39  private $addCocoaPlants = false;
40 
41  public function canPlaceObject(ChunkManager $level, $x, $y, $z){
42  return false;
43  }
44 
45  public function placeObject(ChunkManager $level, $x, $y, $z, $type){
46 
47  $this->trunkHeight = (int) ($this->totalHeight * $this->trunkHeightMultiplier);
48  $leaves = $this->getLeafGroupPoints($level, $pos);
49  foreach($leaves as $leafGroup){
50  $groupX = $leafGroup->getBlockX();
51  $groupY = $leafGroup->getBlockY();
52  $groupZ = $leafGroup->getBlockZ();
53  for($yy = $groupY; $yy < $groupY + $this->leafDistanceLimit; ++$yy){
54  $this->generateGroupLayer($level, $groupX, $yy, $groupZ, $this->getLeafGroupLayerSize($yy - $groupY));
55  }
56  }
57  /*final BlockIterator trunk = new BlockIterator(new Point(w, x, y - 1, z), new Point(w, x, y + trunkHeight, z));
58  while (trunk.hasNext()) {
59  trunk.next().setMaterial(VanillaMaterials.LOG, logMetadata);
60  }
61  generateBranches(w, x, y, z, leaves);
62 
63  $level->setBlock($x, $pos->y - 1, $z, 3, 0);
64  $this->totalHeight += $random->nextRange(0, 2);
65  $this->leavesHeight += mt_rand(0, 1);
66  for($yy = ($this->totalHeight - $this->leavesHeight); $yy < ($this->totalHeight + 1); ++$yy){
67  $yRadius = ($yy - $this->totalHeight);
68  $xzRadius = (int) (($this->radiusIncrease + 1) - $yRadius / 2);
69  for($xx = -$xzRadius; $xx < ($xzRadius + 1); ++$xx){
70  for($zz = -$xzRadius; $zz < ($xzRadius + 1); ++$zz){
71  if((abs($xx) != $xzRadius or abs($zz) != $xzRadius) and $yRadius != 0){
72  $level->setBlock($pos->x + $xx, $pos->y + $yy, $pos->z + $zz, 18, $type);
73  }
74  }
75  }
76  }
77  for($yy = 0; $yy < ($this->totalHeight - 1); ++$yy){
78  $level->setBlock($x, $pos->y + $yy, $z, 17, $type);
79  }
80  */
81  }
82 
83 
84 }