PathfinderSystem - Terasology/TutorialPathfinding GitHub Wiki

Pathfinder System

The Pathfinder System allows developers easy access to creating paths without having to worry too much about the Implementation details. It makes use of Futures (https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Future.html).

    `SettableFuture<List<Path>> pathFuture = pathfinderSystem.requestPath(`
            `actor.getEntity(), currentBlock.getBlockPosition(),`
            `Arrays.asList(workTarget.getBlockPosition()));`

    `Futures.addCallback(pathFuture, new FutureCallback<List<Path>>() {`
                `@Override`
                `public void onSuccess(List<Path> paths) {`
                    `// Called if the Future has been set properly. 'paths' stores the path you requested for`
                `}`

                `@Override`
                `public void onFailure(Throwable t) {`
                    `// Called if Future was not able to be set properly`
                `}`
    `});`
⚠️ **GitHub.com Fallback** ⚠️