45 public function moveTo(
int $x,
int $y,
int $z) : int{
46 $newChunkX = $x >>
SubChunk::COORD_BIT_SIZE;
47 $newChunkZ = $z >> SubChunk::COORD_BIT_SIZE;
48 if($this->currentChunk ===
null || $this->currentX !== $newChunkX || $this->currentZ !== $newChunkZ){
49 $this->currentX = $newChunkX;
50 $this->currentZ = $newChunkZ;
51 $this->currentSubChunk =
null;
53 $this->currentChunk = $this->world->getChunk($this->currentX, $this->currentZ);
54 if($this->currentChunk ===
null){
59 $newChunkY = $y >> SubChunk::COORD_BIT_SIZE;
60 if($this->currentSubChunk ===
null || $this->currentY !== $newChunkY){
61 $this->currentY = $newChunkY;
63 if($this->currentY < Chunk::MIN_SUBCHUNK_INDEX || $this->currentY > Chunk::MAX_SUBCHUNK_INDEX){
64 $this->currentSubChunk =
null;
68 $this->currentSubChunk = $this->currentChunk->getSubChunk($newChunkY);