diff --git a/src/world/format/Chunk.php b/src/world/format/Chunk.php index 7f3f06162..9ba58e829 100644 --- a/src/world/format/Chunk.php +++ b/src/world/format/Chunk.php @@ -505,17 +505,6 @@ class Chunk{ $this->dirtyFlags = 0; } - /** - * Returns the subchunk at the specified subchunk Y coordinate, or an empty, unmodifiable stub if it does not exist or the coordinate is out of range. - */ - public function getSubChunk(int $y) : SubChunkInterface{ - if($y < 0 or $y >= $this->subChunks->getSize()){ - return EmptySubChunk::getInstance(); //TODO: drop this and throw an exception here - } - - return $this->subChunks[$y]; - } - public function getSubChunkChecked(int $y) : SubChunk{ if($y < 0 || $y >= $this->subChunks->getSize()){ throw new \InvalidArgumentException("Invalid subchunk Y coordinate $y"); diff --git a/src/world/format/EmptySubChunk.php b/src/world/format/EmptySubChunk.php deleted file mode 100644 index e1bac9118..000000000 --- a/src/world/format/EmptySubChunk.php +++ /dev/null @@ -1,65 +0,0 @@ -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; } diff --git a/src/world/format/SubChunkInterface.php b/src/world/format/SubChunkInterface.php deleted file mode 100644 index 25f4cce28..000000000 --- a/src/world/format/SubChunkInterface.php +++ /dev/null @@ -1,53 +0,0 @@ -