mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Modernize property declarations in src/world/*
This commit is contained in:
parent
159392e738
commit
b88a47929f
@ -28,20 +28,16 @@ use pocketmine\math\Vector3;
|
|||||||
use pocketmine\utils\Utils;
|
use pocketmine\utils\Utils;
|
||||||
|
|
||||||
class BlockTransaction{
|
class BlockTransaction{
|
||||||
/** @var ChunkManager */
|
|
||||||
private $world;
|
|
||||||
|
|
||||||
/** @var Block[][][] */
|
/** @var Block[][][] */
|
||||||
private $blocks = [];
|
private array $blocks = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \Closure[]
|
* @var \Closure[]
|
||||||
* @phpstan-var (\Closure(ChunkManager $world, int $x, int $y, int $z) : bool)[]
|
* @phpstan-var (\Closure(ChunkManager $world, int $x, int $y, int $z) : bool)[]
|
||||||
*/
|
*/
|
||||||
private $validators = [];
|
private array $validators = [];
|
||||||
|
|
||||||
public function __construct(ChunkManager $world){
|
public function __construct(private ChunkManager $world){
|
||||||
$this->world = $world;
|
|
||||||
$this->addValidator(static function(ChunkManager $world, int $x, int $y, int $z) : bool{
|
$this->addValidator(static function(ChunkManager $world, int $x, int $y, int $z) : bool{
|
||||||
return $world->isInWorld($x, $y, $z);
|
return $world->isInWorld($x, $y, $z);
|
||||||
});
|
});
|
||||||
|
@ -46,8 +46,7 @@ use function mt_rand;
|
|||||||
use function sqrt;
|
use function sqrt;
|
||||||
|
|
||||||
class Explosion{
|
class Explosion{
|
||||||
/** @var int */
|
private int $rays = 16;
|
||||||
private $rays = 16;
|
|
||||||
/** @var World */
|
/** @var World */
|
||||||
public $world;
|
public $world;
|
||||||
/** @var Position */
|
/** @var Position */
|
||||||
@ -59,16 +58,12 @@ class Explosion{
|
|||||||
public $affectedBlocks = [];
|
public $affectedBlocks = [];
|
||||||
/** @var float */
|
/** @var float */
|
||||||
public $stepLen = 0.3;
|
public $stepLen = 0.3;
|
||||||
/** @var Entity|Block|null */
|
|
||||||
private $what;
|
|
||||||
|
|
||||||
/** @var SubChunkExplorer */
|
private Entity|Block|null $what;
|
||||||
private $subChunkExplorer;
|
|
||||||
|
|
||||||
/**
|
private SubChunkExplorer $subChunkExplorer;
|
||||||
* @param Entity|Block|null $what
|
|
||||||
*/
|
public function __construct(Position $center, float $size, Entity|Block|null $what = null){
|
||||||
public function __construct(Position $center, float $size, $what = null){
|
|
||||||
if(!$center->isValid()){
|
if(!$center->isValid()){
|
||||||
throw new \InvalidArgumentException("Position does not have a valid world");
|
throw new \InvalidArgumentException("Position does not have a valid world");
|
||||||
}
|
}
|
||||||
|
@ -34,15 +34,10 @@ class SimpleChunkManager implements ChunkManager{
|
|||||||
/** @var Chunk[] */
|
/** @var Chunk[] */
|
||||||
protected $chunks = [];
|
protected $chunks = [];
|
||||||
|
|
||||||
/** @var int */
|
public function __construct(
|
||||||
private $minY;
|
private int $minY,
|
||||||
/** @var int */
|
private int $maxY
|
||||||
private $maxY;
|
){}
|
||||||
|
|
||||||
public function __construct(int $minY, int $maxY){
|
|
||||||
$this->minY = $minY;
|
|
||||||
$this->maxY = $maxY;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getBlockAt(int $x, int $y, int $z) : Block{
|
public function getBlockAt(int $x, int $y, int $z) : Block{
|
||||||
if($this->isInWorld($x, $y, $z) && ($chunk = $this->getChunk($x >> Chunk::COORD_BIT_SIZE, $z >> Chunk::COORD_BIT_SIZE)) !== null){
|
if($this->isInWorld($x, $y, $z) && ($chunk = $this->getChunk($x >> Chunk::COORD_BIT_SIZE, $z >> Chunk::COORD_BIT_SIZE)) !== null){
|
||||||
|
@ -131,8 +131,7 @@ use const PHP_INT_MIN;
|
|||||||
|
|
||||||
class World implements ChunkManager{
|
class World implements ChunkManager{
|
||||||
|
|
||||||
/** @var int */
|
private static int $worldIdCounter = 1;
|
||||||
private static $worldIdCounter = 1;
|
|
||||||
|
|
||||||
public const Y_MAX = 256;
|
public const Y_MAX = 256;
|
||||||
public const Y_MIN = 0;
|
public const Y_MIN = 0;
|
||||||
@ -154,15 +153,15 @@ class World implements ChunkManager{
|
|||||||
public const DEFAULT_TICKED_BLOCKS_PER_SUBCHUNK_PER_TICK = 3;
|
public const DEFAULT_TICKED_BLOCKS_PER_SUBCHUNK_PER_TICK = 3;
|
||||||
|
|
||||||
/** @var Player[] */
|
/** @var Player[] */
|
||||||
private $players = [];
|
private array $players = [];
|
||||||
|
|
||||||
/** @var Entity[] */
|
/** @var Entity[] */
|
||||||
private $entities = [];
|
private array $entities = [];
|
||||||
/**
|
/**
|
||||||
* @var Vector3[]
|
* @var Vector3[]
|
||||||
* @phpstan-var array<int, Vector3>
|
* @phpstan-var array<int, Vector3>
|
||||||
*/
|
*/
|
||||||
private $entityLastKnownPositions = [];
|
private array $entityLastKnownPositions = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Entity[][]
|
* @var Entity[][]
|
||||||
@ -173,88 +172,66 @@ class World implements ChunkManager{
|
|||||||
/** @var Entity[] */
|
/** @var Entity[] */
|
||||||
public $updateEntities = [];
|
public $updateEntities = [];
|
||||||
/** @var Block[][] */
|
/** @var Block[][] */
|
||||||
private $blockCache = [];
|
private array $blockCache = [];
|
||||||
|
|
||||||
/** @var int */
|
private int $sendTimeTicker = 0;
|
||||||
private $sendTimeTicker = 0;
|
|
||||||
|
|
||||||
/** @var Server */
|
private int $worldId;
|
||||||
private $server;
|
|
||||||
|
|
||||||
/** @var int */
|
private int $providerGarbageCollectionTicker = 0;
|
||||||
private $worldId;
|
|
||||||
|
|
||||||
/** @var WritableWorldProvider */
|
private int $minY;
|
||||||
private $provider;
|
private int $maxY;
|
||||||
/** @var int */
|
|
||||||
private $providerGarbageCollectionTicker = 0;
|
|
||||||
|
|
||||||
/** @var int */
|
|
||||||
private $minY;
|
|
||||||
/** @var int */
|
|
||||||
private $maxY;
|
|
||||||
|
|
||||||
/** @var TickingChunkLoader[] */
|
/** @var TickingChunkLoader[] */
|
||||||
private $tickingLoaders = [];
|
private array $tickingLoaders = [];
|
||||||
/** @var int[] */
|
/** @var int[] */
|
||||||
private $tickingLoaderCounter = [];
|
private array $tickingLoaderCounter = [];
|
||||||
/** @var ChunkLoader[][] */
|
/** @var ChunkLoader[][] */
|
||||||
private $chunkLoaders = [];
|
private array $chunkLoaders = [];
|
||||||
|
|
||||||
/** @var ChunkListener[][] */
|
/** @var ChunkListener[][] */
|
||||||
private $chunkListeners = [];
|
private array $chunkListeners = [];
|
||||||
/** @var Player[][] */
|
/** @var Player[][] */
|
||||||
private $playerChunkListeners = [];
|
private array $playerChunkListeners = [];
|
||||||
|
|
||||||
/** @var ClientboundPacket[][] */
|
/** @var ClientboundPacket[][] */
|
||||||
private $packetBuffersByChunk = [];
|
private array $packetBuffersByChunk = [];
|
||||||
|
|
||||||
/** @var float[] */
|
/** @var float[] */
|
||||||
private $unloadQueue = [];
|
private array $unloadQueue = [];
|
||||||
|
|
||||||
/** @var int */
|
private int $time;
|
||||||
private $time;
|
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $stopTime = false;
|
public $stopTime = false;
|
||||||
|
|
||||||
/** @var float */
|
private float $sunAnglePercentage = 0.0;
|
||||||
private $sunAnglePercentage = 0.0;
|
private int $skyLightReduction = 0;
|
||||||
/** @var int */
|
|
||||||
private $skyLightReduction = 0;
|
|
||||||
|
|
||||||
/** @var string */
|
private string $folderName;
|
||||||
private $folderName;
|
private string $displayName;
|
||||||
/** @var string */
|
|
||||||
private $displayName;
|
|
||||||
|
|
||||||
/** @var Chunk[] */
|
/** @var Chunk[] */
|
||||||
private $chunks = [];
|
private array $chunks = [];
|
||||||
|
|
||||||
/** @var Vector3[][] */
|
/** @var Vector3[][] */
|
||||||
private $changedBlocks = [];
|
private array $changedBlocks = [];
|
||||||
|
|
||||||
/**
|
/** @phpstan-var ReversePriorityQueue<int, Vector3> */
|
||||||
* @var ReversePriorityQueue
|
private ReversePriorityQueue $scheduledBlockUpdateQueue;
|
||||||
* @phpstan-var ReversePriorityQueue<int, Vector3>
|
|
||||||
*/
|
|
||||||
private $scheduledBlockUpdateQueue;
|
|
||||||
/** @var int[] */
|
/** @var int[] */
|
||||||
private $scheduledBlockUpdateQueueIndex = [];
|
private array $scheduledBlockUpdateQueueIndex = [];
|
||||||
|
|
||||||
/**
|
/** @phpstan-var \SplQueue<int> */
|
||||||
* @var \SplQueue
|
private \SplQueue $neighbourBlockUpdateQueue;
|
||||||
* @phpstan-var \SplQueue<int>
|
|
||||||
*/
|
|
||||||
private $neighbourBlockUpdateQueue;
|
|
||||||
/** @var bool[] blockhash => dummy */
|
/** @var bool[] blockhash => dummy */
|
||||||
private $neighbourBlockUpdateQueueIndex = [];
|
private array $neighbourBlockUpdateQueueIndex = [];
|
||||||
|
|
||||||
/** @var bool[] */
|
/** @var bool[] */
|
||||||
private $activeChunkPopulationTasks = [];
|
private array $activeChunkPopulationTasks = [];
|
||||||
/** @var ChunkLockId[] */
|
/** @var ChunkLockId[] */
|
||||||
private $chunkLock = [];
|
private array $chunkLock = [];
|
||||||
/** @var int */
|
private int $maxConcurrentChunkPopulationTasks = 2;
|
||||||
private $maxConcurrentChunkPopulationTasks = 2;
|
|
||||||
/**
|
/**
|
||||||
* @var PromiseResolver[] chunkHash => promise
|
* @var PromiseResolver[] chunkHash => promise
|
||||||
* @phpstan-var array<int, PromiseResolver<Chunk>>
|
* @phpstan-var array<int, PromiseResolver<Chunk>>
|
||||||
@ -272,22 +249,17 @@ class World implements ChunkManager{
|
|||||||
private array $chunkPopulationRequestQueueIndex = [];
|
private array $chunkPopulationRequestQueueIndex = [];
|
||||||
|
|
||||||
/** @var bool[] */
|
/** @var bool[] */
|
||||||
private $generatorRegisteredWorkers = [];
|
private array $generatorRegisteredWorkers = [];
|
||||||
|
|
||||||
/** @var bool */
|
private bool $autoSave = true;
|
||||||
private $autoSave = true;
|
|
||||||
|
|
||||||
/** @var int */
|
private int $sleepTicks = 0;
|
||||||
private $sleepTicks = 0;
|
|
||||||
|
|
||||||
/** @var int */
|
private int $chunkTickRadius;
|
||||||
private $chunkTickRadius;
|
private int $chunksPerTick;
|
||||||
/** @var int */
|
private int $tickedBlocksPerSubchunkPerTick = self::DEFAULT_TICKED_BLOCKS_PER_SUBCHUNK_PER_TICK;
|
||||||
private $chunksPerTick;
|
|
||||||
/** @var int */
|
|
||||||
private $tickedBlocksPerSubchunkPerTick = self::DEFAULT_TICKED_BLOCKS_PER_SUBCHUNK_PER_TICK;
|
|
||||||
/** @var bool[] */
|
/** @var bool[] */
|
||||||
private $randomTickBlocks = [];
|
private array $randomTickBlocks = [];
|
||||||
|
|
||||||
/** @var WorldTimings */
|
/** @var WorldTimings */
|
||||||
public $timings;
|
public $timings;
|
||||||
@ -295,33 +267,22 @@ class World implements ChunkManager{
|
|||||||
/** @var float */
|
/** @var float */
|
||||||
public $tickRateTime = 0;
|
public $tickRateTime = 0;
|
||||||
|
|
||||||
/** @var bool */
|
private bool $doingTick = false;
|
||||||
private $doingTick = false;
|
|
||||||
|
|
||||||
/**
|
/** @phpstan-var class-string<\pocketmine\world\generator\Generator> */
|
||||||
* @var string
|
private string $generator;
|
||||||
* @phpstan-var class-string<\pocketmine\world\generator\Generator>
|
|
||||||
*/
|
|
||||||
private $generator;
|
|
||||||
|
|
||||||
/** @var bool */
|
private bool $unloaded = false;
|
||||||
private $unloaded = false;
|
|
||||||
/**
|
/**
|
||||||
* @var \Closure[]
|
* @var \Closure[]
|
||||||
* @phpstan-var array<int, \Closure() : void>
|
* @phpstan-var array<int, \Closure() : void>
|
||||||
*/
|
*/
|
||||||
private $unloadCallbacks = [];
|
private array $unloadCallbacks = [];
|
||||||
|
|
||||||
/** @var BlockLightUpdate|null */
|
private ?BlockLightUpdate $blockLightUpdate = null;
|
||||||
private $blockLightUpdate = null;
|
private ?SkyLightUpdate $skyLightUpdate = null;
|
||||||
/** @var SkyLightUpdate|null */
|
|
||||||
private $skyLightUpdate = null;
|
|
||||||
|
|
||||||
/** @var \Logger */
|
private \Logger $logger;
|
||||||
private $logger;
|
|
||||||
|
|
||||||
/** @var AsyncPool */
|
|
||||||
private $workerPool;
|
|
||||||
|
|
||||||
public static function chunkHash(int $x, int $z) : int{
|
public static function chunkHash(int $x, int $z) : int{
|
||||||
return morton2d_encode($x, $z);
|
return morton2d_encode($x, $z);
|
||||||
@ -407,12 +368,14 @@ class World implements ChunkManager{
|
|||||||
/**
|
/**
|
||||||
* Init the default world data
|
* Init the default world data
|
||||||
*/
|
*/
|
||||||
public function __construct(Server $server, string $name, WritableWorldProvider $provider, AsyncPool $workerPool){
|
public function __construct(
|
||||||
|
private Server $server,
|
||||||
|
string $name, //TODO: this should be folderName (named arguments BC break)
|
||||||
|
private WritableWorldProvider $provider,
|
||||||
|
private AsyncPool $workerPool
|
||||||
|
){
|
||||||
|
$this->folderName = $name;
|
||||||
$this->worldId = self::$worldIdCounter++;
|
$this->worldId = self::$worldIdCounter++;
|
||||||
$this->server = $server;
|
|
||||||
|
|
||||||
$this->provider = $provider;
|
|
||||||
$this->workerPool = $workerPool;
|
|
||||||
|
|
||||||
$this->displayName = $this->provider->getWorldData()->getName();
|
$this->displayName = $this->provider->getWorldData()->getName();
|
||||||
$this->logger = new \PrefixedLogger($server->getLogger(), "World: $this->displayName");
|
$this->logger = new \PrefixedLogger($server->getLogger(), "World: $this->displayName");
|
||||||
@ -440,7 +403,6 @@ class World implements ChunkManager{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->folderName = $name;
|
|
||||||
|
|
||||||
$this->scheduledBlockUpdateQueue = new ReversePriorityQueue();
|
$this->scheduledBlockUpdateQueue = new ReversePriorityQueue();
|
||||||
$this->scheduledBlockUpdateQueue->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
|
$this->scheduledBlockUpdateQueue->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
|
||||||
|
@ -55,33 +55,19 @@ use function strval;
|
|||||||
use function trim;
|
use function trim;
|
||||||
|
|
||||||
class WorldManager{
|
class WorldManager{
|
||||||
/** @var string */
|
|
||||||
private $dataPath;
|
|
||||||
|
|
||||||
/** @var WorldProviderManager */
|
|
||||||
private $providerManager;
|
|
||||||
|
|
||||||
/** @var World[] */
|
/** @var World[] */
|
||||||
private $worlds = [];
|
private array $worlds = [];
|
||||||
/** @var World|null */
|
private ?World $defaultWorld;
|
||||||
private $defaultWorld;
|
|
||||||
|
|
||||||
/** @var Server */
|
private bool $autoSave = true;
|
||||||
private $server;
|
private int $autoSaveTicks = 6000;
|
||||||
|
private int $autoSaveTicker = 0;
|
||||||
|
|
||||||
/** @var bool */
|
public function __construct(
|
||||||
private $autoSave = true;
|
private Server $server,
|
||||||
/** @var int */
|
private string $dataPath,
|
||||||
private $autoSaveTicks = 6000;
|
private WorldProviderManager $providerManager
|
||||||
|
){}
|
||||||
/** @var int */
|
|
||||||
private $autoSaveTicker = 0;
|
|
||||||
|
|
||||||
public function __construct(Server $server, string $dataPath, WorldProviderManager $providerManager){
|
|
||||||
$this->server = $server;
|
|
||||||
$this->dataPath = $dataPath;
|
|
||||||
$this->providerManager = $providerManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getProviderManager() : WorldProviderManager{
|
public function getProviderManager() : WorldProviderManager{
|
||||||
return $this->providerManager;
|
return $this->providerManager;
|
||||||
|
@ -32,21 +32,17 @@ abstract class Biome{
|
|||||||
|
|
||||||
public const MAX_BIOMES = 256;
|
public const MAX_BIOMES = 256;
|
||||||
|
|
||||||
/** @var int */
|
private int $id;
|
||||||
private $id;
|
private bool $registered = false;
|
||||||
/** @var bool */
|
|
||||||
private $registered = false;
|
|
||||||
|
|
||||||
/** @var Populator[] */
|
/** @var Populator[] */
|
||||||
private $populators = [];
|
private array $populators = [];
|
||||||
|
|
||||||
/** @var int */
|
private int $minElevation;
|
||||||
private $minElevation;
|
private int $maxElevation;
|
||||||
/** @var int */
|
|
||||||
private $maxElevation;
|
|
||||||
|
|
||||||
/** @var Block[] */
|
/** @var Block[] */
|
||||||
private $groundCover = [];
|
private array $groundCover = [];
|
||||||
|
|
||||||
/** @var float */
|
/** @var float */
|
||||||
protected $rainfall = 0.5;
|
protected $rainfall = 0.5;
|
||||||
|
@ -34,7 +34,7 @@ final class BiomeRegistry{
|
|||||||
* @var Biome[]|\SplFixedArray
|
* @var Biome[]|\SplFixedArray
|
||||||
* @phpstan-var \SplFixedArray<Biome>
|
* @phpstan-var \SplFixedArray<Biome>
|
||||||
*/
|
*/
|
||||||
private $biomes;
|
private \SplFixedArray $biomes;
|
||||||
|
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
$this->biomes = new \SplFixedArray(Biome::MAX_BIOMES);
|
$this->biomes = new \SplFixedArray(Biome::MAX_BIOMES);
|
||||||
|
@ -28,9 +28,7 @@ use pocketmine\world\generator\populator\TallGrass;
|
|||||||
use pocketmine\world\generator\populator\Tree;
|
use pocketmine\world\generator\populator\Tree;
|
||||||
|
|
||||||
class ForestBiome extends GrassyBiome{
|
class ForestBiome extends GrassyBiome{
|
||||||
|
private TreeType $type;
|
||||||
/** @var TreeType */
|
|
||||||
private $type;
|
|
||||||
|
|
||||||
public function __construct(?TreeType $type = null){
|
public function __construct(?TreeType $type = null){
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
@ -38,21 +38,16 @@ use function abs;
|
|||||||
|
|
||||||
class Nether extends Generator{
|
class Nether extends Generator{
|
||||||
|
|
||||||
/** @var Populator[] */
|
private int $waterHeight = 32;
|
||||||
private $populators = [];
|
private int $emptyHeight = 64;
|
||||||
/** @var int */
|
private int $emptyAmplitude = 1;
|
||||||
private $waterHeight = 32;
|
private float $density = 0.5;
|
||||||
/** @var int */
|
|
||||||
private $emptyHeight = 64;
|
|
||||||
/** @var int */
|
|
||||||
private $emptyAmplitude = 1;
|
|
||||||
/** @var float */
|
|
||||||
private $density = 0.5;
|
|
||||||
|
|
||||||
/** @var Populator[] */
|
/** @var Populator[] */
|
||||||
private $generationPopulators = [];
|
private array $populators = [];
|
||||||
/** @var Simplex */
|
/** @var Populator[] */
|
||||||
private $noiseBase;
|
private array $generationPopulators = [];
|
||||||
|
private Simplex $noiseBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws InvalidGeneratorOptionsException
|
* @throws InvalidGeneratorOptionsException
|
||||||
|
@ -42,21 +42,14 @@ use pocketmine\world\World;
|
|||||||
|
|
||||||
class Normal extends Generator{
|
class Normal extends Generator{
|
||||||
|
|
||||||
|
private int $waterHeight = 62;
|
||||||
/** @var Populator[] */
|
/** @var Populator[] */
|
||||||
private $populators = [];
|
private array $populators = [];
|
||||||
/** @var int */
|
|
||||||
private $waterHeight = 62;
|
|
||||||
|
|
||||||
/** @var Populator[] */
|
/** @var Populator[] */
|
||||||
private $generationPopulators = [];
|
private array $generationPopulators = [];
|
||||||
/** @var Simplex */
|
private Simplex $noiseBase;
|
||||||
private $noiseBase;
|
private BiomeSelector $selector;
|
||||||
|
private Gaussian $gaussian;
|
||||||
/** @var BiomeSelector */
|
|
||||||
private $selector;
|
|
||||||
|
|
||||||
/** @var Gaussian */
|
|
||||||
private $gaussian;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws InvalidGeneratorOptionsException
|
* @throws InvalidGeneratorOptionsException
|
||||||
|
@ -30,8 +30,7 @@ use function sin;
|
|||||||
use const M_PI;
|
use const M_PI;
|
||||||
|
|
||||||
class Ore{
|
class Ore{
|
||||||
/** @var Random */
|
private Random $random;
|
||||||
private $random;
|
|
||||||
/** @var OreType */
|
/** @var OreType */
|
||||||
public $type;
|
public $type;
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ use pocketmine\world\generator\object\OreType;
|
|||||||
|
|
||||||
class Ore implements Populator{
|
class Ore implements Populator{
|
||||||
/** @var OreType[] */
|
/** @var OreType[] */
|
||||||
private $oreTypes = [];
|
private array $oreTypes = [];
|
||||||
|
|
||||||
public function populate(ChunkManager $world, int $chunkX, int $chunkZ, Random $random) : void{
|
public function populate(ChunkManager $world, int $chunkX, int $chunkZ, Random $random) : void{
|
||||||
foreach($this->oreTypes as $type){
|
foreach($this->oreTypes as $type){
|
||||||
|
@ -30,10 +30,8 @@ use pocketmine\world\ChunkManager;
|
|||||||
use pocketmine\world\format\Chunk;
|
use pocketmine\world\format\Chunk;
|
||||||
|
|
||||||
class TallGrass implements Populator{
|
class TallGrass implements Populator{
|
||||||
/** @var int */
|
private int $randomAmount = 1;
|
||||||
private $randomAmount = 1;
|
private int $baseAmount = 0;
|
||||||
/** @var int */
|
|
||||||
private $baseAmount = 0;
|
|
||||||
|
|
||||||
public function setRandomAmount(int $amount) : void{
|
public function setRandomAmount(int $amount) : void{
|
||||||
$this->randomAmount = $amount;
|
$this->randomAmount = $amount;
|
||||||
|
@ -31,13 +31,9 @@ use pocketmine\world\format\Chunk;
|
|||||||
use pocketmine\world\generator\object\TreeFactory;
|
use pocketmine\world\generator\object\TreeFactory;
|
||||||
|
|
||||||
class Tree implements Populator{
|
class Tree implements Populator{
|
||||||
/** @var int */
|
private int $randomAmount = 1;
|
||||||
private $randomAmount = 1;
|
private int $baseAmount = 0;
|
||||||
/** @var int */
|
private TreeType $type;
|
||||||
private $baseAmount = 0;
|
|
||||||
|
|
||||||
/** @var TreeType */
|
|
||||||
private $type;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TreeType|null $type default oak
|
* @param TreeType|null $type default oak
|
||||||
|
@ -30,22 +30,18 @@ use pocketmine\world\utils\SubChunkExplorerStatus;
|
|||||||
use function max;
|
use function max;
|
||||||
|
|
||||||
class BlockLightUpdate extends LightUpdate{
|
class BlockLightUpdate extends LightUpdate{
|
||||||
|
|
||||||
/**
|
|
||||||
* @var \SplFixedArray|int[]
|
|
||||||
* @phpstan-var \SplFixedArray<int>
|
|
||||||
*/
|
|
||||||
private $lightEmitters;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \SplFixedArray|int[] $lightFilters
|
* @param \SplFixedArray|int[] $lightFilters
|
||||||
* @param \SplFixedArray|int[] $lightEmitters
|
* @param \SplFixedArray|int[] $lightEmitters
|
||||||
* @phpstan-param \SplFixedArray<int> $lightFilters
|
* @phpstan-param \SplFixedArray<int> $lightFilters
|
||||||
* @phpstan-param \SplFixedArray<int> $lightEmitters
|
* @phpstan-param \SplFixedArray<int> $lightEmitters
|
||||||
*/
|
*/
|
||||||
public function __construct(SubChunkExplorer $subChunkExplorer, \SplFixedArray $lightFilters, \SplFixedArray $lightEmitters){
|
public function __construct(
|
||||||
|
SubChunkExplorer $subChunkExplorer,
|
||||||
|
\SplFixedArray $lightFilters,
|
||||||
|
private \SplFixedArray $lightEmitters
|
||||||
|
){
|
||||||
parent::__construct($subChunkExplorer, $lightFilters);
|
parent::__construct($subChunkExplorer, $lightFilters);
|
||||||
$this->lightEmitters = $lightEmitters;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getCurrentLightArray() : LightArray{
|
protected function getCurrentLightArray() : LightArray{
|
||||||
|
@ -33,22 +33,18 @@ use pocketmine\world\World;
|
|||||||
use function max;
|
use function max;
|
||||||
|
|
||||||
class SkyLightUpdate extends LightUpdate{
|
class SkyLightUpdate extends LightUpdate{
|
||||||
|
|
||||||
/**
|
|
||||||
* @var \SplFixedArray|bool[]
|
|
||||||
* @phpstan-var \SplFixedArray<bool>
|
|
||||||
*/
|
|
||||||
private $directSkyLightBlockers;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \SplFixedArray|int[] $lightFilters
|
* @param \SplFixedArray|int[] $lightFilters
|
||||||
* @param \SplFixedArray|bool[] $directSkyLightBlockers
|
* @param \SplFixedArray|bool[] $directSkyLightBlockers
|
||||||
* @phpstan-param \SplFixedArray<int> $lightFilters
|
* @phpstan-param \SplFixedArray<int> $lightFilters
|
||||||
* @phpstan-param \SplFixedArray<bool> $directSkyLightBlockers
|
* @phpstan-param \SplFixedArray<bool> $directSkyLightBlockers
|
||||||
*/
|
*/
|
||||||
public function __construct(SubChunkExplorer $subChunkExplorer, \SplFixedArray $lightFilters, \SplFixedArray $directSkyLightBlockers){
|
public function __construct(
|
||||||
|
SubChunkExplorer $subChunkExplorer,
|
||||||
|
\SplFixedArray $lightFilters,
|
||||||
|
private \SplFixedArray $directSkyLightBlockers
|
||||||
|
){
|
||||||
parent::__construct($subChunkExplorer, $lightFilters);
|
parent::__construct($subChunkExplorer, $lightFilters);
|
||||||
$this->directSkyLightBlockers = $directSkyLightBlockers;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getCurrentLightArray() : LightArray{
|
protected function getCurrentLightArray() : LightArray{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user