Skip to content

Commit

Permalink
add debug to pathfinder code
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Aug 17, 2023
1 parent 2f07adb commit 903e6de
Showing 1 changed file with 8 additions and 4 deletions.
@@ -1,6 +1,7 @@
package com.denizenscript.denizen.utilities.world;

import com.denizenscript.denizen.objects.LocationTag;
import com.denizenscript.denizencore.utilities.debugging.Debug;
import net.citizensnpcs.api.astar.AStarMachine;
import net.citizensnpcs.api.astar.pathfinder.*;
import org.bukkit.Location;
Expand All @@ -18,10 +19,13 @@ public class PathFinder {

public static List<LocationTag> getPath(Location start, Location dest) {
VectorGoal goal = new VectorGoal(dest, 1);
Path plan = (Path) ASTAR.runFully(goal,
new VectorNode(goal, start, new ChunkBlockSource(start, 100), new MinecraftBlockExaminer()),
50000);
if (plan == null || plan.isComplete()) {
Path plan = (Path) ASTAR.runFully(goal, new VectorNode(goal, start, new ChunkBlockSource(start, 100), new MinecraftBlockExaminer()), 50000);
if (plan == null) {
Debug.verboseLog("PathFinder: No path found from " + start + " to " + dest + " (return null)");
return new ArrayList<>();
}
if (plan.isComplete()) {
Debug.verboseLog("PathFinder: path from " + start + " to " + dest + " is instantly completed");
return new ArrayList<>();
}
else {
Expand Down

0 comments on commit 903e6de

Please sign in to comment.