Skip to content

Instantly share code, notes, and snippets.

@PJZ9n
Last active April 6, 2020 07:20
Show Gist options
  • Save PJZ9n/7224876dcb5bc91fd2b3edb16bc5dd1a to your computer and use it in GitHub Desktop.
Save PJZ9n/7224876dcb5bc91fd2b3edb16bc5dd1a to your computer and use it in GitHub Desktop.
Vector3からChunkの座標を取得する
/** @var $pos pocketmine\math\Vector3 */
$chunkX = $pos->getFloorX() >> 4;
$chunkZ = $pos->getFloorZ() >> 4;
//参考: https://github.com/pmmp/PocketMine-MP/blob/stable/src/pocketmine/level/Level.php#L2306
/** @var $pos pocketmine\math\Vector3 */
$chunkInX = $pos->getFloorX() & 0x0f;
$chunkInZ = $pos->getFloorZ() & 0x0f;
//参考: https://web.lobi.co/game/minecraftpe/group/64881349b85c596d297fcf07a7745ba434043bef/chat/696491828878311424
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment