Use Chunk::getSubChunkChecked() in places where we know that an invalid coordinate cannot be requested

This commit is contained in:
Dylan K. Taylor
2020-10-31 22:48:41 +00:00
parent b270029161
commit 01001dca74
3 changed files with 6 additions and 9 deletions

View File

@ -27,7 +27,6 @@ use pocketmine\utils\Utils;
use pocketmine\world\ChunkManager;
use pocketmine\world\format\Chunk;
use pocketmine\world\format\SubChunk;
use function assert;
class SubChunkExplorer{
/** @var ChunkManager */
@ -78,9 +77,7 @@ class SubChunkExplorer{
return SubChunkExplorerStatus::INVALID;
}
$newSubChunk = $this->currentChunk->getSubChunk($y >> 4);
assert($newSubChunk instanceof SubChunk, "chunk inside valid bounds should always be a SubChunk instance");
$this->currentSubChunk = $newSubChunk;
$this->currentSubChunk = $this->currentChunk->getSubChunkChecked($y >> 4);
if($this->onSubChunkChangeFunc !== null){
($this->onSubChunkChangeFunc)();
}