Fix debug pathfinding

This commit is contained in:
fullwall 2014-01-12 12:50:05 +08:00
parent 8ff4d336ff
commit 66a07f8f05
3 changed files with 9 additions and 6 deletions

View File

@ -68,15 +68,17 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
double xzDistance = dX * dX + dZ * dZ;
double distance = xzDistance + dY * dY;
if (Setting.DEBUG_PATHFINDING.asBoolean()) {
for (int i = 0; i < 5; i++) {
npc.getEntity().getWorld().playEffect(npc.getStoredLocation(), Effect.MOBSPAWNER_FLAMES, 0);
for (int i = 0; i < 3; i++) {
npc.getEntity().getWorld()
.playEffect(vector.toLocation(npc.getEntity().getWorld()), Effect.ENDER_SIGNAL, 0);
}
}
if (distance > 0 && dY > 0 && xzDistance <= 2.75) {
if (distance > 0 && dY > 0 && dY < 1 && xzDistance <= 2.75) {
NMS.setShouldJump(npc.getEntity());
}
NMS.setDestination(npc.getEntity(), vector.getX(), vector.getY(), vector.getZ(), params.speed());
params.tick();
params.run();
plan.run(npc);
return false;
}

View File

@ -80,7 +80,8 @@ public class FlyingAStarNavigationStrategy extends AbstractPathStrategy {
NMS.setVerticalMovement(npc.getEntity(), 0.5);
NMS.setHeadYaw(NMS.getHandle(npc.getEntity()), current.getYaw() + normalisedTargetYaw);
parameters.tick();
parameters.run();
plan.run(npc);
return false;
}

View File

@ -59,7 +59,7 @@ public class MCNavigationStrategy extends AbstractPathStrategy {
return true;
navigation.a(parameters.avoidWater());
navigation.a(parameters.speed());
parameters.tick();
parameters.run();
return NMS.isNavigationFinished(navigation);
}
}