mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-22 17:18:20 +01:00
Fix some navigation bugs (thanks jrbudda)
This commit is contained in:
parent
7bd21c3161
commit
41ba6b1f64
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,4 +2,5 @@
|
||||
/target
|
||||
.classpath
|
||||
.project
|
||||
Citizens.jar
|
||||
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,7 +116,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
navigation.e();
|
||||
moveOnCurrentHeading();
|
||||
} else if (!npc.getNavigator().isNavigating() && (motX != 0 || motZ != 0 || motY != 0)) {
|
||||
e(0, 0);// is this necessary? it does gravity/controllable but
|
||||
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
|
||||
}
|
||||
if (noDamageTicks > 0)
|
||||
@ -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