Skip to content

StimoMC-OLD/Pathfinder

 
 

Repository files navigation

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

About

PocketMine-MP Pathfinder

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%