mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
More typehints, documentation fixes and static analysis cleanup
This commit is contained in:
@ -44,7 +44,7 @@ abstract class Tree{
|
||||
public $leafBlock = Block::LEAVES;
|
||||
public $treeHeight = 7;
|
||||
|
||||
public static function growTree(ChunkManager $level, $x, $y, $z, Random $random, $type = 0){
|
||||
public static function growTree(ChunkManager $level, int $x, int $y, int $z, Random $random, int $type = 0){
|
||||
switch($type){
|
||||
case Sapling::SPRUCE:
|
||||
$tree = new SpruceTree();
|
||||
@ -78,7 +78,7 @@ abstract class Tree{
|
||||
public function canPlaceObject(ChunkManager $level, int $x, int $y, int $z, Random $random) : bool{
|
||||
$radiusToCheck = 0;
|
||||
for($yy = 0; $yy < $this->treeHeight + 3; ++$yy){
|
||||
if($yy == 1 or $yy === $this->treeHeight){
|
||||
if($yy === 1 or $yy === $this->treeHeight){
|
||||
++$radiusToCheck;
|
||||
}
|
||||
for($xx = -$radiusToCheck; $xx < ($radiusToCheck + 1); ++$xx){
|
||||
@ -93,7 +93,7 @@ abstract class Tree{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random){
|
||||
public function placeObject(ChunkManager $level, int $x, int $y, int $z, Random $random){
|
||||
|
||||
$this->placeTrunk($level, $x, $y, $z, $random, $this->treeHeight - 1);
|
||||
|
||||
@ -116,7 +116,7 @@ abstract class Tree{
|
||||
}
|
||||
}
|
||||
|
||||
protected function placeTrunk(ChunkManager $level, $x, $y, $z, Random $random, $trunkHeight){
|
||||
protected function placeTrunk(ChunkManager $level, int $x, int $y, int $z, Random $random, int $trunkHeight){
|
||||
// The base dirt block
|
||||
$level->setBlockIdAt($x, $y - 1, $z, Block::DIRT);
|
||||
|
||||
|
Reference in New Issue
Block a user