diff --git a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java index 6e11f0b80..07f6e88ee 100644 --- a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java +++ b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java @@ -1110,7 +1110,7 @@ public class NMSImpl implements NMSBridge { @Override public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) { - getHandle(entity).setYBodyRot(yaw); + getHandle(entity).setYRot(yaw); } @Override diff --git a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/PlayerLookControl.java b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/PlayerLookControl.java index 5e8694ef6..d0a2c33c5 100644 --- a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/PlayerLookControl.java +++ b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/PlayerLookControl.java @@ -22,8 +22,11 @@ public class PlayerLookControl { } public void a() { - if (!NMSImpl.isNavigationFinished(this.a.getNavigation())) + if (!NMSImpl.isNavigationFinished(this.a.getNavigation())) { + // TODO: use Citizens AI? + // this.a.yHeadRot = Mth.rotateIfNecessary(this.a.yHeadRot, this.a.yBodyRot, 75); return; + } if (this.b()) { // this.a.setXRot(0.0F); } @@ -63,9 +66,6 @@ public class PlayerLookControl { } else { // this.a.yHeadRot = rotateTowards(this.a.yHeadRot, this.a.yBodyRot, 10.0F); } - if (!this.a.getNavigation().isDone()) { // TODO: use Citizens AI? - this.a.yHeadRot = Mth.rotateIfNecessary(this.a.yHeadRot, this.a.yBodyRot, 75); - } } public void a(double var0, double var2, double var4) { diff --git a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/PlayerMoveControl.java b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/PlayerMoveControl.java index b34f5f9df..a9645742e 100644 --- a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/PlayerMoveControl.java +++ b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/PlayerMoveControl.java @@ -15,7 +15,7 @@ import net.minecraft.world.entity.monster.Slime; public class PlayerMoveControl extends MoveControl { protected LivingEntity a; - private int h; + private int jumpTicks; protected boolean moving; protected double speed; protected double tx; @@ -31,10 +31,6 @@ public class PlayerMoveControl extends MoveControl { this.tz = entityinsentient.getZ(); } - protected int cg() { - return new Random().nextInt(20) + 10; - } - @Override public double getSpeedModifier() { return this.speed; @@ -60,6 +56,10 @@ public class PlayerMoveControl extends MoveControl { return this.moving; } + protected int jumpTicks() { + return new Random().nextInt(20) + 10; + } + @Override protected float rotlerp(float f, float f1, float f2) { float f3 = Mth.wrapDegrees(f1 - f); @@ -92,11 +92,11 @@ public class PlayerMoveControl extends MoveControl { this.moving = true; } - private boolean shouldSlimeJump() { + private boolean shouldJump() { if (!(this.a instanceof Slime)) { return false; } - if (this.h-- <= 0) { + if (this.jumpTicks-- <= 0) { return true; } return false; @@ -115,7 +115,7 @@ public class PlayerMoveControl extends MoveControl { this.a.zza = 0.0F; return; } - float f = (float) Math.toDegrees(Mth.atan2(dZ, dX)) - 90.0F; + float f = (float) (Mth.atan2(dZ, dX) * 57.2957763671875D) - 90.0F; this.a.setYRot(rotlerp(this.a.getYRot(), f, 90.0F)); NMS.setHeadYaw(a.getBukkitEntity(), this.a.getYRot()); AttributeInstance speed = this.a.getAttribute(Attributes.MOVEMENT_SPEED); @@ -123,9 +123,9 @@ public class PlayerMoveControl extends MoveControl { float movement = (float) (this.speed * speed.getValue()); this.a.setSpeed(movement); this.a.zza = movement; - if (shouldSlimeJump() || (dY >= NMS.getStepHeight(a.getBukkitEntity()) && dXZ < 1.0D)) { - this.h = cg(); - this.h /= 3; + if (shouldJump() || (dY >= NMS.getStepHeight(a.getBukkitEntity()) && dXZ < 1.0D)) { + this.jumpTicks = jumpTicks(); + this.jumpTicks /= 3; if (this.a instanceof EntityHumanNPC) { ((EntityHumanNPC) this.a).getControllerJump().jump(); } else { diff --git a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/PlayerNavigation.java b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/PlayerNavigation.java index 7d024513c..0da018879 100644 --- a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/PlayerNavigation.java +++ b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/PlayerNavigation.java @@ -527,7 +527,7 @@ public class PlayerNavigation extends PathNavigation { if (isDone()) return; Vec3 var0 = this.path.getNextEntityPos(this.mob); - BlockPos var1 = new BlockPos(var0); + BlockPos var1 = new BlockPos(var0); this.mob.getMoveControl().setWantedPosition(var0.x, this.level.getBlockState(var1.down()).isAir() ? var0.y : WalkNodeEvaluator.getFloorLevel(this.level, var1), var0.z, this.speedModifier); }