Skip to content

Latest commit

 

History

History
45 lines (35 loc) · 1.33 KB

README.md

File metadata and controls

45 lines (35 loc) · 1.33 KB

A WIP PocketMine Pathfinder

Features:

  • AStar pathfinding
  • Pathfinding can be divided into several ticks
  • Set costs for various blocks
  • Navigator for entities

API:

Finding a path between two points:

  1. Create an AStar-Object
$aStar = new AStar(World $world, Vector3 $startVector3, Vector3 $targetVector3, ?AxisAlignedBB $axisAlignedBB, ?AlgorithmSettings $settings);
  1. Configure settings (See AlgorithmSettings-Class for all available methods)
$aStar->getSettings()
    ->setTimeout(0.5)
    ->setMaxTicks(10);
...
  1. Start and get pathfinding result
$aStar->then(function(?PathResult $pathResult): void {
    if($pathResult === null) {
        echo "No path found!";
        return;
    }
    echo "Path found!";
})->start();

Important:

This pathfinder is not the best, but you can help to improve it. If you see code places that can be improved or any method/variable names that don't fit, please create a pull request with the respective changes.

Thanks!

Contact me:

Twitter
Discord: Matze#1754