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
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
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;

View File

@ -115,6 +115,6 @@ final class FastChunkSerializer{
$biomeIds = new BiomeArray($stream->get(256));
return new Chunk($subChunks, $biomeIds, null, $terrainPopulated);
return new Chunk($subChunks, $biomeIds, $terrainPopulated);
}
}

View File

@ -417,7 +417,6 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
$chunk = new Chunk(
$subChunks,
$biomeArray,
null,
$terrainPopulated
);

View File

@ -92,7 +92,6 @@ trait LegacyAnvilChunkTrait{
new Chunk(
$subChunks,
$biomeArray,
null,
$chunk->getByte("TerrainPopulated", 0) !== 0
),
($entitiesTag = $chunk->getTag("Entities")) instanceof ListTag ? self::getCompoundList("Entities", $entitiesTag) : [],

View File

@ -86,7 +86,6 @@ class McRegion extends RegionWorldProvider{
new Chunk(
$subChunks,
$biomeIds,
null,
$chunk->getByte("TerrainPopulated", 0) !== 0
),
($entitiesTag = $chunk->getTag("Entities")) instanceof ListTag ? self::getCompoundList("Entities", $entitiesTag) : [],