Skip to content

Commit

Permalink
Fix inconsistency in canNavigate where flyable/living status was not …
Browse files Browse the repository at this point in the history
…respected
  • Loading branch information
fullwall committed Apr 21, 2024
1 parent 59531a9 commit 77d34b5
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -31,6 +31,7 @@
import net.citizensnpcs.api.ai.event.NavigationStuckEvent;
import net.citizensnpcs.api.ai.event.NavigatorCallback;
import net.citizensnpcs.api.astar.pathfinder.DoorExaminer;
import net.citizensnpcs.api.astar.pathfinder.FlyingBlockExaminer;
import net.citizensnpcs.api.astar.pathfinder.MinecraftBlockExaminer;
import net.citizensnpcs.api.astar.pathfinder.SwimmingExaminer;
import net.citizensnpcs.api.npc.NPC;
Expand Down Expand Up @@ -93,7 +94,10 @@ public boolean canNavigateTo(Location dest) {

@Override
public boolean canNavigateTo(Location dest, NavigatorParameters params) {
if (defaultParams.useNewPathfinder()) {
if (defaultParams.useNewPathfinder() || !(npc.getEntity() instanceof LivingEntity)) {
if (npc.isFlyable()) {
params.examiner(new FlyingBlockExaminer());
}
AStarPlanner planner = new AStarPlanner(params, npc.getStoredLocation(), dest);
planner.tick(Setting.MAXIMUM_ASTAR_ITERATIONS.asInt(), Setting.MAXIMUM_ASTAR_ITERATIONS.asInt());
return planner.plan != null;
Expand Down

0 comments on commit 77d34b5

Please sign in to comment.