Fix some navigation bugs (thanks jrbudda)

This commit is contained in:
fullwall 2012-09-24 16:40:13 +08:00
parent 7bd21c3161
commit 41ba6b1f64
3 changed files with 12 additions and 2 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
.classpath .classpath
.project .project
Citizens.jar Citizens.jar
*.lnk

View File

@ -140,6 +140,10 @@ public class CitizensNavigator implements Navigator {
executing = null; executing = null;
localParams = defaultParams; localParams = defaultParams;
stationaryTicks = 0; stationaryTicks = 0;
if (npc.isSpawned()) {
EntityLiving entity = npc.getHandle();
entity.motX = entity.motY = entity.motZ = 0F;
}
} }
private void stopNavigating(CancelReason reason) { private void stopNavigating(CancelReason reason) {

View File

@ -116,7 +116,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
navigation.e(); navigation.e();
moveOnCurrentHeading(); moveOnCurrentHeading();
} else if (!npc.getNavigator().isNavigating() && (motX != 0 || motZ != 0 || motY != 0)) { } 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 // sometimes players sink into the ground
} }
if (noDamageTicks > 0) if (noDamageTicks > 0)
@ -180,5 +183,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
as = yaw; // update head yaw to match entity yaw as = yaw; // update head yaw to match entity yaw
} }
private static final float EPSILON = 0.001F;
private static final float STEP_HEIGHT = 1F; private static final float STEP_HEIGHT = 1F;
} }