protected function checkTeleportPosition()
{
if ($this->teleportPosition !== null) {
$chunkX = $this->teleportPosition->x >> 4;
$chunkZ = $this->teleportPosition->z >> 4;
for ($X = -1; $X <= 1; ++$X) {
for ($Z = -1; $Z <= 1; ++$Z) {
if (!isset($this->usedChunks[$index = Level::chunkHash($chunkX + $X, $chunkZ + $Z)]) or $this->usedChunks[$index] === false) {
return false;
}
}
}
$this->sendPosition($this, null, null, 1);
$this->spawnToAll();
$this->forceMovement = $this->teleportPosition;
$this->teleportPosition = null;
return true;
}
return true;
}