Remove $create parameter from ChunkManager::getChunk()

this restores SimpleChunkManager's behaviour to PM3, removing the need for GeneratorChunkManager (although I'm dubious whether SubChunkExplorer makes any sense in there any more now that we have morton in the mix).
This commit is contained in:
Dylan K. Taylor
2020-10-31 21:54:51 +00:00
parent dec235abab
commit ddda2d1e64
11 changed files with 27 additions and 68 deletions

View File

@ -58,13 +58,13 @@ class SubChunkExplorer{
/**
* @phpstan-return SubChunkExplorerStatus::*
*/
public function moveTo(int $x, int $y, int $z, bool $create) : int{
public function moveTo(int $x, int $y, int $z) : int{
if($this->currentChunk === null or $this->currentX !== ($x >> 4) or $this->currentZ !== ($z >> 4)){
$this->currentX = $x >> 4;
$this->currentZ = $z >> 4;
$this->currentSubChunk = null;
$this->currentChunk = $this->world->getChunk($this->currentX, $this->currentZ, $create);
$this->currentChunk = $this->world->getChunk($this->currentX, $this->currentZ);
if($this->currentChunk === null){
return SubChunkExplorerStatus::INVALID;
}
@ -93,9 +93,9 @@ class SubChunkExplorer{
/**
* @phpstan-return SubChunkExplorerStatus::*
*/
public function moveToChunk(int $chunkX, int $chunkY, int $chunkZ, bool $create) : int{
public function moveToChunk(int $chunkX, int $chunkY, int $chunkZ) : int{
//this is a cold path, so we don't care much if it's a bit slower (extra fcall overhead)
return $this->moveTo($chunkX << 4, $chunkY << 4, $chunkZ << 4, $create);
return $this->moveTo($chunkX << 4, $chunkY << 4, $chunkZ << 4);
}
/**