mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-11 05:55:33 +00:00
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:
parent
b8519d1af4
commit
9835d75f65
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -417,7 +417,6 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
|
||||
$chunk = new Chunk(
|
||||
$subChunks,
|
||||
$biomeArray,
|
||||
null,
|
||||
$terrainPopulated
|
||||
);
|
||||
|
||||
|
@ -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) : [],
|
||||
|
@ -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) : [],
|
||||
|
Loading…
x
Reference in New Issue
Block a user