mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 14:35:35 +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
|
* @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);
|
$this->subChunks = new \SplFixedArray(Chunk::MAX_SUBCHUNKS);
|
||||||
|
|
||||||
foreach($this->subChunks as $y => $null){
|
foreach($this->subChunks as $y => $null){
|
||||||
@ -77,7 +77,7 @@ class Chunk{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$val = ($this->subChunks->getSize() * SubChunk::EDGE_LENGTH);
|
$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->biomeIds = $biomeIds ?? BiomeArray::fill(BiomeIds::OCEAN);
|
||||||
|
|
||||||
$this->terrainPopulated = $terrainPopulated;
|
$this->terrainPopulated = $terrainPopulated;
|
||||||
|
@ -115,6 +115,6 @@ final class FastChunkSerializer{
|
|||||||
|
|
||||||
$biomeIds = new BiomeArray($stream->get(256));
|
$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(
|
$chunk = new Chunk(
|
||||||
$subChunks,
|
$subChunks,
|
||||||
$biomeArray,
|
$biomeArray,
|
||||||
null,
|
|
||||||
$terrainPopulated
|
$terrainPopulated
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -92,7 +92,6 @@ trait LegacyAnvilChunkTrait{
|
|||||||
new Chunk(
|
new Chunk(
|
||||||
$subChunks,
|
$subChunks,
|
||||||
$biomeArray,
|
$biomeArray,
|
||||||
null,
|
|
||||||
$chunk->getByte("TerrainPopulated", 0) !== 0
|
$chunk->getByte("TerrainPopulated", 0) !== 0
|
||||||
),
|
),
|
||||||
($entitiesTag = $chunk->getTag("Entities")) instanceof ListTag ? self::getCompoundList("Entities", $entitiesTag) : [],
|
($entitiesTag = $chunk->getTag("Entities")) instanceof ListTag ? self::getCompoundList("Entities", $entitiesTag) : [],
|
||||||
|
@ -86,7 +86,6 @@ class McRegion extends RegionWorldProvider{
|
|||||||
new Chunk(
|
new Chunk(
|
||||||
$subChunks,
|
$subChunks,
|
||||||
$biomeIds,
|
$biomeIds,
|
||||||
null,
|
|
||||||
$chunk->getByte("TerrainPopulated", 0) !== 0
|
$chunk->getByte("TerrainPopulated", 0) !== 0
|
||||||
),
|
),
|
||||||
($entitiesTag = $chunk->getTag("Entities")) instanceof ListTag ? self::getCompoundList("Entities", $entitiesTag) : [],
|
($entitiesTag = $chunk->getTag("Entities")) instanceof ListTag ? self::getCompoundList("Entities", $entitiesTag) : [],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user