Skip to content

Instantly share code, notes, and snippets.

@MakStashkevich
Last active August 1, 2020 17:10
Show Gist options
  • Save MakStashkevich/eb7cf96bcd965dfaa3604db02a152344 to your computer and use it in GitHub Desktop.
Save MakStashkevich/eb7cf96bcd965dfaa3604db02a152344 to your computer and use it in GitHub Desktop.
Convert chunk XZ to world XZ
<?php
$chunkX = -10;
$chunkZ = 10;
$minX = $chunkX << 4;
$maxX = $minX + 16;
$minZ = $chunkZ << 4;
$maxZ = $minZ + 16;
echo 'Chunk(X:' . $chunkX . ', Z:' . $chunkZ .') (minX:' . $minX . ', maxX:' . $maxX . ', minZ:' . $minZ . ', maxZ:' . $maxZ . ')';
// Chunk(X:-10, Z:10) (minX:-160, maxX:-144, minZ:160, maxZ:176)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment