Removed EmptySubChunk and SubChunkInterface

This commit is contained in:
Dylan K. Taylor
2020-10-31 23:10:31 +00:00
parent 13d7b7ee1a
commit e09d78238f
4 changed files with 10 additions and 130 deletions

View File

@ -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;
}