mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Apply more typehints to generator namespace
This commit is contained in:
@ -31,7 +31,7 @@ use pocketmine\utils\Random;
|
||||
|
||||
class GroundCover extends Populator{
|
||||
|
||||
public function populate(ChunkManager $level, int $chunkX, int $chunkZ, Random $random){
|
||||
public function populate(ChunkManager $level, int $chunkX, int $chunkZ, Random $random) : void{
|
||||
$chunk = $level->getChunk($chunkX, $chunkZ);
|
||||
for($x = 0; $x < 16; ++$x){
|
||||
for($z = 0; $z < 16; ++$z){
|
||||
|
@ -32,7 +32,7 @@ class Ore extends Populator{
|
||||
/** @var OreType[] */
|
||||
private $oreTypes = [];
|
||||
|
||||
public function populate(ChunkManager $level, int $chunkX, int $chunkZ, Random $random){
|
||||
public function populate(ChunkManager $level, int $chunkX, int $chunkZ, Random $random) : void{
|
||||
foreach($this->oreTypes as $type){
|
||||
$ore = new ObjectOre($random, $type);
|
||||
for($i = 0; $i < $ore->type->clusterCount; ++$i){
|
||||
@ -49,7 +49,7 @@ class Ore extends Populator{
|
||||
/**
|
||||
* @param OreType[] $types
|
||||
*/
|
||||
public function setOreTypes(array $types){
|
||||
public function setOreTypes(array $types) : void{
|
||||
$this->oreTypes = $types;
|
||||
}
|
||||
}
|
||||
|
@ -33,11 +33,9 @@ abstract class Populator{
|
||||
|
||||
/**
|
||||
* @param ChunkManager $level
|
||||
* @param int $chunkX
|
||||
* @param int $chunkZ
|
||||
* @param Random $random
|
||||
*
|
||||
* @return mixed
|
||||
* @param int $chunkX
|
||||
* @param int $chunkZ
|
||||
* @param Random $random
|
||||
*/
|
||||
abstract public function populate(ChunkManager $level, int $chunkX, int $chunkZ, Random $random);
|
||||
abstract public function populate(ChunkManager $level, int $chunkX, int $chunkZ, Random $random) : void;
|
||||
}
|
||||
|
@ -33,15 +33,15 @@ class TallGrass extends Populator{
|
||||
private $randomAmount;
|
||||
private $baseAmount;
|
||||
|
||||
public function setRandomAmount($amount){
|
||||
public function setRandomAmount(int $amount) : void{
|
||||
$this->randomAmount = $amount;
|
||||
}
|
||||
|
||||
public function setBaseAmount($amount){
|
||||
public function setBaseAmount(int $amount) : void{
|
||||
$this->baseAmount = $amount;
|
||||
}
|
||||
|
||||
public function populate(ChunkManager $level, int $chunkX, int $chunkZ, Random $random){
|
||||
public function populate(ChunkManager $level, int $chunkX, int $chunkZ, Random $random) : void{
|
||||
$this->level = $level;
|
||||
$amount = $random->nextRange(0, $this->randomAmount + 1) + $this->baseAmount;
|
||||
for($i = 0; $i < $amount; ++$i){
|
||||
|
@ -37,19 +37,19 @@ class Tree extends Populator{
|
||||
|
||||
private $type;
|
||||
|
||||
public function __construct($type = Sapling::OAK){
|
||||
public function __construct(int $type = Sapling::OAK){
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
public function setRandomAmount($amount){
|
||||
public function setRandomAmount(int $amount) : void{
|
||||
$this->randomAmount = $amount;
|
||||
}
|
||||
|
||||
public function setBaseAmount($amount){
|
||||
public function setBaseAmount(int $amount) : void{
|
||||
$this->baseAmount = $amount;
|
||||
}
|
||||
|
||||
public function populate(ChunkManager $level, int $chunkX, int $chunkZ, Random $random){
|
||||
public function populate(ChunkManager $level, int $chunkX, int $chunkZ, Random $random) : void{
|
||||
$this->level = $level;
|
||||
$amount = $random->nextRange(0, $this->randomAmount + 1) + $this->baseAmount;
|
||||
for($i = 0; $i < $amount; ++$i){
|
||||
|
Reference in New Issue
Block a user