Nullcheck

This commit is contained in:
fullwall 2012-12-02 22:39:01 +08:00
parent fda23a1b47
commit b36f1e74d4
1 changed files with 2 additions and 2 deletions

View File

@ -26,7 +26,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
this.params = params;
this.dest = dest;
this.npc = npc;
Location location = npc.getBukkitEntity().getLocation();
Location location = npc.getBukkitEntity().getEyeLocation();
plan = (Path) ASTAR.runFully(new VectorGoal(dest), new VectorNode(location, new ChunkBlockSource(
location, params.range()), params.examiners()), 10000);
if (plan == null || plan.isComplete())
@ -49,7 +49,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
public boolean update() {
if (getCancelReason() != null)
return true;
if (plan.isComplete())
if (plan == null || plan.isComplete())
return true;
if (NMS.distanceSquared(npc.getHandle(), vector) <= params.distanceMargin()) {
plan.update(npc);