mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-09-11 07:08:17 +02:00
Change speed of pathfinder, seems to work better
This commit is contained in:
parent
fe370258db
commit
2517a5629d
@ -114,8 +114,10 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
||||
cancelReason = CancelReason.TARGET_MOVED_WORLD;
|
||||
return true;
|
||||
}
|
||||
if (cancelReason != null)
|
||||
if (cancelReason != null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
setPath();
|
||||
NMS.look(handle, target);
|
||||
if (aggro && canAttack()) {
|
||||
@ -126,8 +128,9 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
||||
}
|
||||
attackTicks = ATTACK_DELAY_TICKS;
|
||||
}
|
||||
if (attackTicks > 0)
|
||||
if (attackTicks > 0) {
|
||||
attackTicks--;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -155,11 +155,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
// (onGround is normally updated by the client)
|
||||
}
|
||||
if (!npc.data().get("removefromplayerlist", Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean())) {
|
||||
// h(); TODO
|
||||
i();// TODO
|
||||
}
|
||||
if (Math.abs(motX) < EPSILON && Math.abs(motY) < EPSILON && Math.abs(motZ) < EPSILON)
|
||||
motX = motY = motZ = 0;
|
||||
|
||||
if (navigating) {
|
||||
if (!NMS.isNavigationFinished(navigation)) {
|
||||
NMS.updateNavigation(navigation);
|
||||
@ -173,6 +172,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
if (noDamageTicks > 0) {
|
||||
--noDamageTicks;
|
||||
}
|
||||
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@ -221,12 +221,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
|
||||
private void moveOnCurrentHeading() {
|
||||
NMS.updateAI(this);
|
||||
// taken from EntityLiving update method
|
||||
if (bd) {
|
||||
/* boolean inLiquid = H() || J();
|
||||
if (inLiquid) {
|
||||
motY += 0.04;
|
||||
} else //(handled elsewhere)*/
|
||||
if (onGround && jumpTicks == 0) {
|
||||
bj();
|
||||
jumpTicks = 10;
|
||||
@ -237,7 +232,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
be *= 0.98F;
|
||||
bf *= 0.98F;
|
||||
bg *= 0.9F;
|
||||
|
||||
e(be, bf); // movement method
|
||||
NMS.setHeadYaw(this, yaw);
|
||||
if (jumpTicks > 0) {
|
||||
|
@ -91,8 +91,8 @@ public class NMS {
|
||||
if (!success)
|
||||
return;
|
||||
if (knockbackLevel > 0) {
|
||||
target.g(-MathHelper.sin((float) (handle.yaw * Math.PI / 180.0F)) * knockbackLevel * 0.5F, 0.1D,
|
||||
MathHelper.cos((float) (handle.yaw * Math.PI / 180.0F)) * knockbackLevel * 0.5F);
|
||||
target.g(-Math.sin(handle.yaw * Math.PI / 180.0F) * knockbackLevel * 0.5F, 0.1D,
|
||||
Math.cos(handle.yaw * Math.PI / 180.0F) * knockbackLevel * 0.5F);
|
||||
handle.motX *= 0.6D;
|
||||
handle.motZ *= 0.6D;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public class PlayerControllerMove {
|
||||
}
|
||||
|
||||
public void c() {
|
||||
this.a.bf = 0F;
|
||||
this.a.bf = 0;
|
||||
if (this.f) {
|
||||
this.f = false;
|
||||
int i = MathHelper.floor(this.a.boundingBox.b + 0.5D);
|
||||
@ -60,8 +60,7 @@ public class PlayerControllerMove {
|
||||
double d1 = this.d - this.a.locZ;
|
||||
double d2 = this.c - i;
|
||||
double d3 = d0 * d0 + d2 * d2 + d1 * d1;
|
||||
|
||||
if (d3 >= 2.5D) {
|
||||
if (d3 >= 2.500000277905201E-7D) {
|
||||
float f = (float) (Math.atan2(d1, d0) * 180.0D / Math.PI) - 90.0F;
|
||||
|
||||
this.a.yaw = this.a(this.a.yaw, f, 30.0F);
|
||||
|
@ -36,6 +36,7 @@ public class PlayerNavigation extends Navigation {
|
||||
this.a = entityinsentient;
|
||||
this.b = world;
|
||||
this.e = entityinsentient.getAttributeInstance(GenericAttributes.b);
|
||||
this.e.setValue(24);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -254,7 +255,6 @@ public class PlayerNavigation extends Navigation {
|
||||
Vec3D localVec3D = this.c.a(this.a);
|
||||
if (localVec3D == null)
|
||||
return;
|
||||
|
||||
this.a.setMoveDestination(localVec3D.c, localVec3D.d, localVec3D.e, this.d);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user