mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 18:45:29 +01:00
Check world in navigator
This commit is contained in:
parent
49c6d3cbed
commit
2c8ac01aea
@ -153,7 +153,8 @@ public class CitizensNavigator implements Navigator, Runnable {
|
||||
updateMountedStatus();
|
||||
if (!isNavigating() || !npc.isSpawned() || paused)
|
||||
return;
|
||||
if (Math.pow(localParams.range(), 2) < npc.getStoredLocation().distanceSquared(getTargetAsLocation())) {
|
||||
if (!npc.getStoredLocation().getWorld().equals(getTargetAsLocation().getWorld())
|
||||
|| Math.pow(localParams.range(), 2) < npc.getStoredLocation().distanceSquared(getTargetAsLocation())) {
|
||||
stopNavigating(CancelReason.STUCK);
|
||||
return;
|
||||
}
|
||||
|
@ -36,9 +36,9 @@ public class Poses extends Trait {
|
||||
}
|
||||
|
||||
private void assumePose(float yaw, float pitch) {
|
||||
if (!npc.isSpawned())
|
||||
if (!npc.isSpawned()) {
|
||||
npc.spawn(npc.getTrait(CurrentLocation.class).getLocation());
|
||||
|
||||
}
|
||||
Util.assumePose(npc.getEntity(), yaw, pitch);
|
||||
}
|
||||
|
||||
@ -66,9 +66,11 @@ public class Poses extends Trait {
|
||||
}
|
||||
|
||||
public Pose getPose(String name) {
|
||||
for (Pose pose : poses.values())
|
||||
if (pose.getName().equalsIgnoreCase(name))
|
||||
for (Pose pose : poses.values()) {
|
||||
if (pose.getName().equalsIgnoreCase(name)) {
|
||||
return pose;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user