-
-
Notifications
You must be signed in to change notification settings - Fork 0
API Pathfinding & Walking
Eisi05 edited this page Jan 21, 2026
·
2 revisions
NpcAPI supports:
- Computing a
Pathvia A* (PathfindingUtils) - Moving an NPC along that
Path(NPC#walkTo(...))
import de.eisi05.npc.api.pathfinding.Path;
import de.eisi05.npc.api.pathfinding.PathfindingUtils;
List<Location> waypoints = List.of(start, mid, end);
Path path = PathfindingUtils.findPath(
waypoints,
50_000, // maxIterations
true, // allowDiagonalMovement
null // progressListener (segmentIndex, totalSegments)
);Async:
PathfindingUtils.findPathAsync(waypoints, 50_000, true, (i, total) -> {
// progress updates
}).thenAccept(path -> {
// use the path
});import de.eisi05.npc.api.enums.WalkingResult;
npc.walkTo(
path,
0.3, // walkSpeed (clamped 0.1 .. 1)
true, // changeRealLocation
(WalkingResult result) -> {
// SUCCESS or CANCELLED
}
// optionally: viewers...
);Notes:
- Calling
walkTo(...)cancels any current walking task. - Walking is tracked per viewer. Use
npc.isWalking(viewer). - Stop walking via
npc.cancelWalking(viewer).