mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-23 01:27:33 +01:00
Fix some navigation bugs (thanks jrbudda)
This commit is contained in:
parent
7bd21c3161
commit
41ba6b1f64
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
|||||||
.classpath
|
.classpath
|
||||||
.project
|
.project
|
||||||
Citizens.jar
|
Citizens.jar
|
||||||
|
*.lnk
|
@ -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) {
|
||||||
|
@ -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;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user