level = $level; $this->allocateEmptySubs = $allocateEmptySubs; } public function moveTo(int $x, int $y, int $z) : bool{ 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->level->getChunk($this->currentX, $this->currentZ); if($this->currentChunk === null){ return false; } } if($this->currentSubChunk === null or $this->currentY !== ($y >> 4)){ $this->currentY = $y >> 4; $this->currentSubChunk = $this->currentChunk->getSubChunk($y >> 4, $this->allocateEmptySubs); if($this->currentSubChunk instanceof EmptySubChunk){ return false; } } return true; } public function invalidate() : void{ $this->currentChunk = null; $this->currentSubChunk = null; } }