mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
Removed EmptySubChunk and SubChunkInterface
This commit is contained in:
@ -26,7 +26,7 @@ namespace pocketmine\world\format;
|
||||
use function array_values;
|
||||
use function count;
|
||||
|
||||
class SubChunk implements SubChunkInterface{
|
||||
class SubChunk{
|
||||
/** @var int */
|
||||
private $defaultBlock;
|
||||
/** @var PalettedBlockArray[] */
|
||||
@ -50,11 +50,20 @@ class SubChunk implements SubChunkInterface{
|
||||
$this->blockLight = $blockLight ?? LightArray::fill(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this subchunk contains any non-air blocks.
|
||||
* This function will do a slow check, usually by garbage collecting first.
|
||||
* This is typically useful for disk saving.
|
||||
*/
|
||||
public function isEmptyAuthoritative() : bool{
|
||||
$this->collectGarbage();
|
||||
return $this->isEmptyFast();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a non-authoritative bool to indicate whether the chunk contains any blocks.
|
||||
* This may report non-empty erroneously if the chunk has been modified and not garbage-collected.
|
||||
*/
|
||||
public function isEmptyFast() : bool{
|
||||
return count($this->blockLayers) === 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user