Chunk: rename DIRTY_FLAG_TERRAIN to DIRTY_FLAG_BLOCKS

we use the word 'terrain' elsewhere to refer to the combination of blocks and biomes, so using TERRAIN here is misleading.
This commit is contained in:
Dylan K. Taylor 2021-10-28 22:11:07 +01:00
parent a62ce64fdd
commit d410db4302
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
3 changed files with 6 additions and 6 deletions

View File

@ -32,7 +32,7 @@ use pocketmine\block\tile\Tile;
use function array_map; use function array_map;
class Chunk{ class Chunk{
public const DIRTY_FLAG_TERRAIN = 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 MAX_SUBCHUNKS = 16; public const MAX_SUBCHUNKS = 16;
@ -106,7 +106,7 @@ class Chunk{
*/ */
public function setFullBlock(int $x, int $y, int $z, int $block) : void{ public function setFullBlock(int $x, int $y, int $z, int $block) : void{
$this->getSubChunk($y >> SubChunk::COORD_BIT_SIZE)->setFullBlock($x, $y & SubChunk::COORD_MASK, $z, $block); $this->getSubChunk($y >> SubChunk::COORD_BIT_SIZE)->setFullBlock($x, $y & SubChunk::COORD_MASK, $z, $block);
$this->terrainDirtyFlags |= self::DIRTY_FLAG_TERRAIN; $this->terrainDirtyFlags |= self::DIRTY_FLAG_BLOCKS;
} }
/** /**
@ -186,7 +186,7 @@ class Chunk{
public function setPopulated(bool $value = true) : void{ public function setPopulated(bool $value = true) : void{
$this->terrainPopulated = $value; $this->terrainPopulated = $value;
$this->terrainDirtyFlags |= self::DIRTY_FLAG_TERRAIN; $this->terrainDirtyFlags |= self::DIRTY_FLAG_BLOCKS;
} }
public function addTile(Tile $tile) : void{ public function addTile(Tile $tile) : void{
@ -295,7 +295,7 @@ class Chunk{
} }
$this->subChunks[$y] = $subChunk ?? new SubChunk(BlockLegacyIds::AIR << Block::INTERNAL_METADATA_BITS, []); $this->subChunks[$y] = $subChunk ?? new SubChunk(BlockLegacyIds::AIR << Block::INTERNAL_METADATA_BITS, []);
$this->setTerrainDirtyFlag(self::DIRTY_FLAG_TERRAIN, true); $this->setTerrainDirtyFlag(self::DIRTY_FLAG_BLOCKS, true);
} }
/** /**

View File

@ -436,7 +436,7 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
$write->put($index . self::TAG_VERSION, chr(self::CURRENT_LEVEL_CHUNK_VERSION)); $write->put($index . self::TAG_VERSION, chr(self::CURRENT_LEVEL_CHUNK_VERSION));
$chunk = $chunkData->getChunk(); $chunk = $chunkData->getChunk();
if($chunk->getTerrainDirtyFlag(Chunk::DIRTY_FLAG_TERRAIN)){ if($chunk->getTerrainDirtyFlag(Chunk::DIRTY_FLAG_BLOCKS)){
$subChunks = $chunk->getSubChunks(); $subChunks = $chunk->getSubChunks();
foreach($subChunks as $y => $subChunk){ foreach($subChunks as $y => $subChunk){
$key = $index . self::TAG_SUBCHUNK_PREFIX . chr($y); $key = $index . self::TAG_SUBCHUNK_PREFIX . chr($y);

View File

@ -117,7 +117,7 @@ class PopulationTask extends AsyncTask{
if($chunk === null){ if($chunk === null){
throw new AssumptionFailedError("We just set this chunk, so it must exist"); throw new AssumptionFailedError("We just set this chunk, so it must exist");
} }
$chunk->setTerrainDirtyFlag(Chunk::DIRTY_FLAG_TERRAIN, true); $chunk->setTerrainDirtyFlag(Chunk::DIRTY_FLAG_BLOCKS, true);
$chunk->setTerrainDirtyFlag(Chunk::DIRTY_FLAG_BIOMES, true); $chunk->setTerrainDirtyFlag(Chunk::DIRTY_FLAG_BIOMES, true);
} }
return $chunk; return $chunk;