mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-09 11:16:57 +00:00
Chunk: make all parameters of __construct() mandatory and non-nullable
having the constructor fill in defaults for these invariably causes bugs.
This commit is contained in:
@ -68,7 +68,7 @@ class Chunk{
|
||||
/**
|
||||
* @param SubChunk[] $subChunks
|
||||
*/
|
||||
public function __construct(array $subChunks = [], ?BiomeArray $biomeIds = null, bool $terrainPopulated = false){
|
||||
public function __construct(array $subChunks, BiomeArray $biomeIds, bool $terrainPopulated){
|
||||
$this->subChunks = new \SplFixedArray(Chunk::MAX_SUBCHUNKS);
|
||||
|
||||
foreach($this->subChunks as $y => $null){
|
||||
@ -77,7 +77,7 @@ class Chunk{
|
||||
|
||||
$val = ($this->subChunks->getSize() * SubChunk::EDGE_LENGTH);
|
||||
$this->heightMap = HeightArray::fill($val); //TODO: what about lazily initializing this?
|
||||
$this->biomeIds = $biomeIds ?? BiomeArray::fill(BiomeIds::OCEAN);
|
||||
$this->biomeIds = $biomeIds;
|
||||
|
||||
$this->terrainPopulated = $terrainPopulated;
|
||||
}
|
||||
|
Reference in New Issue
Block a user