mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
First look at 3D biome support
This commit is contained in:
@ -40,6 +40,7 @@ class SubChunk{
|
||||
public function __construct(
|
||||
private int $emptyBlockId,
|
||||
private array $blockLayers,
|
||||
private PalettedBlockArray $biomes,
|
||||
private ?LightArray $skyLight = null,
|
||||
private ?LightArray $blockLight = null
|
||||
){}
|
||||
@ -102,6 +103,8 @@ class SubChunk{
|
||||
return null; //highest block not in this subchunk
|
||||
}
|
||||
|
||||
public function getBiomeArray() : PalettedBlockArray{ return $this->biomes; }
|
||||
|
||||
public function getBlockSkyLightArray() : LightArray{
|
||||
return $this->skyLight ??= LightArray::fill(0);
|
||||
}
|
||||
@ -137,6 +140,7 @@ class SubChunk{
|
||||
unset($this->blockLayers[$k]);
|
||||
}
|
||||
$this->blockLayers = array_values($this->blockLayers);
|
||||
$this->biomes->collectGarbage();
|
||||
|
||||
if($this->skyLight !== null && $this->skyLight->isUniform(0)){
|
||||
$this->skyLight = null;
|
||||
@ -150,6 +154,7 @@ class SubChunk{
|
||||
$this->blockLayers = array_map(function(PalettedBlockArray $array) : PalettedBlockArray{
|
||||
return clone $array;
|
||||
}, $this->blockLayers);
|
||||
$this->biomes = clone $this->biomes;
|
||||
|
||||
if($this->skyLight !== null){
|
||||
$this->skyLight = clone $this->skyLight;
|
||||
|
Reference in New Issue
Block a user