mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 10:36:10 +01:00
Fix some navigation bugs (thanks jrbudda)
This commit is contained in:
parent
491f566e2a
commit
cf09688a79
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
||||
.classpath
|
||||
.project
|
||||
Citizens.jar
|
||||
*.lnk
|
@ -140,6 +140,10 @@ public class CitizensNavigator implements Navigator {
|
||||
executing = null;
|
||||
localParams = defaultParams;
|
||||
stationaryTicks = 0;
|
||||
if (npc.isSpawned()) {
|
||||
EntityLiving entity = npc.getHandle();
|
||||
entity.motX = entity.motY = entity.motZ = 0F;
|
||||
}
|
||||
}
|
||||
|
||||
private void stopNavigating(CancelReason reason) {
|
||||
|
@ -116,6 +116,9 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
navigation.e();
|
||||
moveOnCurrentHeading();
|
||||
} else if (!npc.getNavigator().isNavigating() && (motX != 0 || motZ != 0 || motY != 0)) {
|
||||
if (Math.abs(motX) < EPSILON && Math.abs(motY) < EPSILON && Math.abs(motZ) < EPSILON) {
|
||||
motX = motY = motZ = 0;
|
||||
} else
|
||||
e(0, 0); // is this necessary? it does gravity/controllable but
|
||||
// sometimes players sink into the ground
|
||||
}
|
||||
@ -180,5 +183,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
as = yaw; // update head yaw to match entity yaw
|
||||
}
|
||||
|
||||
private static final float EPSILON = 0.001F;
|
||||
|
||||
private static final float STEP_HEIGHT = 1F;
|
||||
}
|
Loading…
Reference in New Issue
Block a user