mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-07 02:21:46 +00:00
Chunk: added DIRTY_FLAGS_ALL and DIRTY_FLAGS_NONE
This commit is contained in:
parent
a49842278a
commit
5a9cdef40c
@ -36,6 +36,9 @@ class Chunk{
|
|||||||
public const DIRTY_FLAG_BLOCKS = 1 << 0;
|
public const DIRTY_FLAG_BLOCKS = 1 << 0;
|
||||||
public const DIRTY_FLAG_BIOMES = 1 << 3;
|
public const DIRTY_FLAG_BIOMES = 1 << 3;
|
||||||
|
|
||||||
|
public const DIRTY_FLAGS_ALL = ~0;
|
||||||
|
public const DIRTY_FLAGS_NONE = 0;
|
||||||
|
|
||||||
public const MIN_SUBCHUNK_INDEX = -4;
|
public const MIN_SUBCHUNK_INDEX = -4;
|
||||||
public const MAX_SUBCHUNK_INDEX = 19;
|
public const MAX_SUBCHUNK_INDEX = 19;
|
||||||
public const MAX_SUBCHUNKS = self::MAX_SUBCHUNK_INDEX - self::MIN_SUBCHUNK_INDEX + 1;
|
public const MAX_SUBCHUNKS = self::MAX_SUBCHUNK_INDEX - self::MIN_SUBCHUNK_INDEX + 1;
|
||||||
@ -44,7 +47,7 @@ class Chunk{
|
|||||||
public const COORD_BIT_SIZE = SubChunk::COORD_BIT_SIZE;
|
public const COORD_BIT_SIZE = SubChunk::COORD_BIT_SIZE;
|
||||||
public const COORD_MASK = SubChunk::COORD_MASK;
|
public const COORD_MASK = SubChunk::COORD_MASK;
|
||||||
|
|
||||||
private int $terrainDirtyFlags = ~0;
|
private int $terrainDirtyFlags = self::DIRTY_FLAGS_ALL;
|
||||||
|
|
||||||
protected ?bool $lightPopulated = false;
|
protected ?bool $lightPopulated = false;
|
||||||
protected bool $terrainPopulated = false;
|
protected bool $terrainPopulated = false;
|
||||||
@ -248,7 +251,7 @@ class Chunk{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function isTerrainDirty() : bool{
|
public function isTerrainDirty() : bool{
|
||||||
return $this->terrainDirtyFlags !== 0;
|
return $this->terrainDirtyFlags !== self::DIRTY_FLAGS_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTerrainDirtyFlag(int $flag) : bool{
|
public function getTerrainDirtyFlag(int $flag) : bool{
|
||||||
@ -268,11 +271,11 @@ class Chunk{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function setTerrainDirty() : void{
|
public function setTerrainDirty() : void{
|
||||||
$this->terrainDirtyFlags = ~0;
|
$this->terrainDirtyFlags = self::DIRTY_FLAGS_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function clearTerrainDirtyFlags() : void{
|
public function clearTerrainDirtyFlags() : void{
|
||||||
$this->terrainDirtyFlags = 0;
|
$this->terrainDirtyFlags = self::DIRTY_FLAGS_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSubChunk(int $y) : SubChunk{
|
public function getSubChunk(int $y) : SubChunk{
|
||||||
|
@ -143,7 +143,7 @@ class FormatConverter{
|
|||||||
$thisRound = $start;
|
$thisRound = $start;
|
||||||
foreach($this->oldProvider->getAllChunks(true, $this->logger) as $coords => $loadedChunkData){
|
foreach($this->oldProvider->getAllChunks(true, $this->logger) as $coords => $loadedChunkData){
|
||||||
[$chunkX, $chunkZ] = $coords;
|
[$chunkX, $chunkZ] = $coords;
|
||||||
$new->saveChunk($chunkX, $chunkZ, $loadedChunkData->getData(), ~0);
|
$new->saveChunk($chunkX, $chunkZ, $loadedChunkData->getData(), Chunk::DIRTY_FLAGS_ALL);
|
||||||
$counter++;
|
$counter++;
|
||||||
if(($counter % $this->chunksPerProgressUpdate) === 0){
|
if(($counter % $this->chunksPerProgressUpdate) === 0){
|
||||||
$time = microtime(true);
|
$time = microtime(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user