diff --git a/main/src/main/java/net/citizensnpcs/npc/ai/AStarNavigationStrategy.java b/main/src/main/java/net/citizensnpcs/npc/ai/AStarNavigationStrategy.java index 377170a00..833917798 100644 --- a/main/src/main/java/net/citizensnpcs/npc/ai/AStarNavigationStrategy.java +++ b/main/src/main/java/net/citizensnpcs/npc/ai/AStarNavigationStrategy.java @@ -141,7 +141,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy { } Location loc = npc.getEntity().getLocation(NPC_LOCATION); /* Proper door movement - gets stuck on corners at times - + Block block = currLoc.getWorld().getBlockAt(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); if (MinecraftBlockExaminer.isDoor(block.getType())) { Door door = (Door) block.getState().getData(); @@ -151,8 +151,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy { destVector.setZ(vector.getZ() + targetFace.getModZ()); } }*/ - Location dest = Util.getCenterLocation( - new Location(loc.getWorld(), vector.getX(), vector.getY(), vector.getZ()).getBlock()); + Location dest = Util.getCenterLocation(vector.toLocation(loc.getWorld()).getBlock()); double dX = dest.getX() - loc.getX(); double dZ = dest.getZ() - loc.getZ(); double dY = dest.getY() - loc.getY(); diff --git a/main/src/main/java/net/citizensnpcs/npc/ai/MCTargetStrategy.java b/main/src/main/java/net/citizensnpcs/npc/ai/MCTargetStrategy.java index 83525647c..818b63b0f 100644 --- a/main/src/main/java/net/citizensnpcs/npc/ai/MCTargetStrategy.java +++ b/main/src/main/java/net/citizensnpcs/npc/ai/MCTargetStrategy.java @@ -154,6 +154,8 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget { @Override public Location getCurrentDestination() { + if (strategy == null) + return null; return strategy.getCurrentDestination(); } @@ -221,6 +223,8 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget { @Override public Location getCurrentDestination() { + if (active == null) + return null; return active.getCurrentDestination(); }