SubChunkExplorer: ditch subChunkChangeFunc

this is better implemented by checking the moveTo() result, which also won't have circular dependencies.
This commit is contained in:
Dylan K. Taylor 2020-10-31 23:46:27 +00:00
parent 817372c55b
commit c1a451f3b1

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace pocketmine\world\utils;
use pocketmine\utils\Utils;
use pocketmine\world\ChunkManager;
use pocketmine\world\format\Chunk;
use pocketmine\world\format\SubChunk;
@ -44,12 +43,6 @@ class SubChunkExplorer{
/** @var int */
protected $currentZ;
/**
* @var \Closure|null
* @phpstan-var (\Closure() : void)|null
*/
private $onSubChunkChangeFunc = null;
public function __construct(ChunkManager $world){
$this->world = $world;
}
@ -78,9 +71,6 @@ class SubChunkExplorer{
}
$this->currentSubChunk = $this->currentChunk->getSubChunk($y >> 4);
if($this->onSubChunkChangeFunc !== null){
($this->onSubChunkChangeFunc)();
}
return SubChunkExplorerStatus::MOVED;
}
@ -95,14 +85,6 @@ class SubChunkExplorer{
return $this->moveTo($chunkX << 4, $chunkY << 4, $chunkZ << 4);
}
/**
* @phpstan-param \Closure() : void $callback
*/
public function onSubChunkChange(\Closure $callback) : void{
Utils::validateCallableSignature(function() : void{}, $callback);
$this->onSubChunkChangeFunc = $callback;
}
/**
* Returns whether we currently have a valid terrain pointer.
*/