Skip to content

Instantly share code, notes, and snippets.

@Frago9876543210
Created December 27, 2018 15:51
Show Gist options
  • Save Frago9876543210/3037eda697db4a7626f5626646e5ff1c to your computer and use it in GitHub Desktop.
Save Frago9876543210/3037eda697db4a7626f5626646e5ff1c to your computer and use it in GitHub Desktop.
<?php
declare(strict_types=1);
use pocketmine\math\Vector3;
require_once "vendor/autoload.php";
function minVector(Vector3 $v1, Vector3 $v2) : Vector3{
return new Vector3(min($v1->x, $v2->x) >> 9, 0, min($v1->z, $v2->z) >> 9);
}
function maxVector(Vector3 $v1, Vector3 $v2) : Vector3{
return new Vector3(max($v1->x, $v2->x) >> 9, 0, max($v1->z, $v2->z) >> 9);
}
function printRegions(Vector3 $pos1, Vector3 $pos2){
$min = minVector($pos1, $pos2);
$max = maxVector($pos1, $pos2);
for($x = $min->x; $x <= $max->x; $x++){
for($z = $min->z; $z <= $max->z; $z++){
echo "r.$x.$z.mca" . PHP_EOL;
}
}
}
printRegions(new Vector3(2947, 0, 1242), new Vector3(3072, 0, 1585));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment