diff --git a/src/main/java/net/citizensnpcs/npc/ai/MCTargetStrategy.java b/src/main/java/net/citizensnpcs/npc/ai/MCTargetStrategy.java index dd57cf924..0b12f6bb5 100644 --- a/src/main/java/net/citizensnpcs/npc/ai/MCTargetStrategy.java +++ b/src/main/java/net/citizensnpcs/npc/ai/MCTargetStrategy.java @@ -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; } diff --git a/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java b/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java index 56e522233..53bdf844d 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java @@ -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) { diff --git a/src/main/java/net/citizensnpcs/util/NMS.java b/src/main/java/net/citizensnpcs/util/NMS.java index 669a9453a..2f0d95b52 100644 --- a/src/main/java/net/citizensnpcs/util/NMS.java +++ b/src/main/java/net/citizensnpcs/util/NMS.java @@ -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; } diff --git a/src/main/java/net/citizensnpcs/util/nms/PlayerControllerMove.java b/src/main/java/net/citizensnpcs/util/nms/PlayerControllerMove.java index 3291130b1..38b13bb1a 100644 --- a/src/main/java/net/citizensnpcs/util/nms/PlayerControllerMove.java +++ b/src/main/java/net/citizensnpcs/util/nms/PlayerControllerMove.java @@ -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); diff --git a/src/main/java/net/citizensnpcs/util/nms/PlayerNavigation.java b/src/main/java/net/citizensnpcs/util/nms/PlayerNavigation.java index 15e8f92fa..88a7691d2 100644 --- a/src/main/java/net/citizensnpcs/util/nms/PlayerNavigation.java +++ b/src/main/java/net/citizensnpcs/util/nms/PlayerNavigation.java @@ -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); }