Chunk: removed heighArray parameter from constructor

we don't pass this anywhere, and really it should be dynamically initialized anyway, just like light.
This commit is contained in:
Dylan K. Taylor
2021-10-25 20:13:50 +01:00
parent b8519d1af4
commit 9835d75f65
5 changed files with 3 additions and 6 deletions

View File

@ -69,7 +69,7 @@ class Chunk{
/**
* @param SubChunk[] $subChunks
*/
public function __construct(array $subChunks = [], ?BiomeArray $biomeIds = null, ?HeightArray $heightMap = null, bool $terrainPopulated = false){
public function __construct(array $subChunks = [], ?BiomeArray $biomeIds = null, bool $terrainPopulated = false){
$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 = $heightMap ?? new HeightArray(array_fill(0, 256, $val));
$this->heightMap = new HeightArray(array_fill(0, 256, $val)); //TODO: what about lazily initializing this?
$this->biomeIds = $biomeIds ?? BiomeArray::fill(BiomeIds::OCEAN);
$this->terrainPopulated = $terrainPopulated;