Fixed and silenced some inspections

This commit is contained in:
Dylan K. Taylor
2017-02-23 15:10:23 +00:00
parent 99995579d7
commit f98a964cdc
6 changed files with 23 additions and 17 deletions

View File

@ -22,6 +22,7 @@
namespace pocketmine\level\generator\object;
use pocketmine\level\ChunkManager;
use pocketmine\utils\Random;
class BigTree extends Tree{
private $trunkHeightMultiplier = 0.618;
@ -38,13 +39,13 @@ class BigTree extends Tree{
private $addLogVines = false;
private $addCocoaPlants = false;
public function canPlaceObject(ChunkManager $level, $x, $y, $z){
public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random){
return false;
}
public function placeObject(ChunkManager $level, $x, $y, $z, $type){
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random){
$this->trunkHeight = (int) ($this->totalHeight * $this->trunkHeightMultiplier);
/*$this->trunkHeight = (int) ($this->totalHeight * $this->trunkHeightMultiplier);
$leaves = $this->getLeafGroupPoints($level, $pos);
foreach($leaves as $leafGroup){
$groupX = $leafGroup->getBlockX();
@ -54,7 +55,7 @@ class BigTree extends Tree{
$this->generateGroupLayer($level, $groupX, $yy, $groupZ, $this->getLeafGroupLayerSize($yy - $groupY));
}
}
/*final BlockIterator trunk = new BlockIterator(new Point(w, x, y - 1, z), new Point(w, x, y + trunkHeight, z));
final BlockIterator trunk = new BlockIterator(new Point(w, x, y - 1, z), new Point(w, x, y + trunkHeight, z));
while (trunk.hasNext()) {
trunk.next().setMaterial(VanillaMaterials.LOG, logMetadata);
}
@ -69,13 +70,13 @@ class BigTree extends Tree{
for($xx = -$xzRadius; $xx < ($xzRadius + 1); ++$xx){
for($zz = -$xzRadius; $zz < ($xzRadius + 1); ++$zz){
if((abs($xx) != $xzRadius or abs($zz) != $xzRadius) and $yRadius != 0){
$level->setBlock($pos->x + $xx, $pos->y + $yy, $pos->z + $zz, 18, $type);
$level->setBlock($pos->x + $xx, $pos->y + $yy, $pos->z + $zz, 18, $this->type);
}
}
}
}
for($yy = 0; $yy < ($this->totalHeight - 1); ++$yy){
$level->setBlock($x, $pos->y + $yy, $z, 17, $type);
$level->setBlock($x, $pos->y + $yy, $z, 17, $this->type);
}
*/
}

View File

@ -36,6 +36,7 @@ class Pond{
}
public function canPlaceObject(ChunkManager $level, Vector3 $pos){
return false;
}
public function placeObject(ChunkManager $level, Vector3 $pos){

View File

@ -23,6 +23,7 @@ namespace pocketmine\level\generator\populator;
use pocketmine\block\Water;
use pocketmine\level\ChunkManager;
use pocketmine\math\Vector3;
use pocketmine\utils\Random;
class Pond extends Populator{
@ -36,8 +37,8 @@ class Pond extends Populator{
$y = $random->nextBoundedInt(128);
$z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 16);
$pond = new \pocketmine\level\generator\object\Pond($random, new Water());
if($pond->canPlaceObject($level, $x, $y, $z)){
$pond->placeObject($level, $x, $y, $z);
if($pond->canPlaceObject($level, $v = new Vector3($x, $y, $z))){
$pond->placeObject($level, $v);
}
}
}