mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Modernize property declarations in src/world/generator
This commit is contained in:
parent
46c504e529
commit
ed2a239334
@ -34,11 +34,9 @@ use pocketmine\world\generator\populator\Populator;
|
||||
use function count;
|
||||
|
||||
class Flat extends Generator{
|
||||
|
||||
/** @var Chunk */
|
||||
private $chunk;
|
||||
private Chunk $chunk;
|
||||
/** @var Populator[] */
|
||||
private $populators = [];
|
||||
private array $populators = [];
|
||||
|
||||
private FlatGeneratorOptions $options;
|
||||
|
||||
|
@ -26,11 +26,9 @@ namespace pocketmine\world\generator;
|
||||
use function exp;
|
||||
|
||||
final class Gaussian{
|
||||
|
||||
/** @var int */
|
||||
public $smoothSize;
|
||||
public int $smoothSize;
|
||||
/** @var float[][] */
|
||||
public $kernel = [];
|
||||
public array $kernel = [];
|
||||
|
||||
public function __construct(int $smoothSize){
|
||||
$this->smoothSize = $smoothSize;
|
||||
|
@ -37,7 +37,7 @@ final class GeneratorManager{
|
||||
* @var GeneratorManagerEntry[] name => classname mapping
|
||||
* @phpstan-var array<string, GeneratorManagerEntry>
|
||||
*/
|
||||
private $list = [];
|
||||
private array $list = [];
|
||||
|
||||
public function __construct(){
|
||||
$this->addGenerator(Flat::class, "flat", \Closure::fromCallable(function(string $preset) : ?InvalidGeneratorOptionsException{
|
||||
|
@ -31,7 +31,7 @@ final class ThreadLocalGeneratorContext{
|
||||
* @var self[]
|
||||
* @phpstan-var array<int, self>
|
||||
*/
|
||||
private static $contexts = [];
|
||||
private static array $contexts = [];
|
||||
|
||||
public static function register(self $context, int $worldId) : void{
|
||||
self::$contexts[$worldId] = $context;
|
||||
@ -45,19 +45,11 @@ final class ThreadLocalGeneratorContext{
|
||||
return self::$contexts[$worldId] ?? null;
|
||||
}
|
||||
|
||||
/** @var Generator */
|
||||
private $generator;
|
||||
|
||||
/** @var int */
|
||||
private $worldMinY;
|
||||
/** @var int */
|
||||
private $worldMaxY;
|
||||
|
||||
public function __construct(Generator $generator, int $worldMinY, int $worldMaxY){
|
||||
$this->generator = $generator;
|
||||
$this->worldMinY = $worldMinY;
|
||||
$this->worldMaxY = $worldMaxY;
|
||||
}
|
||||
public function __construct(
|
||||
private Generator $generator,
|
||||
private int $worldMinY,
|
||||
private int $worldMaxY
|
||||
){}
|
||||
|
||||
public function getGenerator() : Generator{ return $this->generator; }
|
||||
|
||||
|
@ -30,16 +30,14 @@ use pocketmine\world\biome\UnknownBiome;
|
||||
use pocketmine\world\generator\noise\Simplex;
|
||||
|
||||
abstract class BiomeSelector{
|
||||
/** @var Simplex */
|
||||
private $temperature;
|
||||
/** @var Simplex */
|
||||
private $rainfall;
|
||||
private Simplex $temperature;
|
||||
private Simplex $rainfall;
|
||||
|
||||
/**
|
||||
* @var Biome[]|\SplFixedArray
|
||||
* @phpstan-var \SplFixedArray<Biome>
|
||||
*/
|
||||
private $map = null;
|
||||
private \SplFixedArray $map = null;
|
||||
|
||||
public function __construct(Random $random){
|
||||
$this->temperature = new Simplex($random, 2, 1 / 16, 1 / 512);
|
||||
|
Loading…
x
Reference in New Issue
Block a user