Fix mistranslation

This commit is contained in:
fullwall 2021-06-30 23:22:26 +08:00
parent 5306a68b6a
commit aabdf8e37a
4 changed files with 17 additions and 17 deletions

View File

@ -1110,7 +1110,7 @@ public class NMSImpl implements NMSBridge {
@Override @Override
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) { public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
getHandle(entity).setYBodyRot(yaw); getHandle(entity).setYRot(yaw);
} }
@Override @Override

View File

@ -22,8 +22,11 @@ public class PlayerLookControl {
} }
public void a() { 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; return;
}
if (this.b()) { if (this.b()) {
// this.a.setXRot(0.0F); // this.a.setXRot(0.0F);
} }
@ -63,9 +66,6 @@ public class PlayerLookControl {
} else { } else {
// this.a.yHeadRot = rotateTowards(this.a.yHeadRot, this.a.yBodyRot, 10.0F); // 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) { public void a(double var0, double var2, double var4) {

View File

@ -15,7 +15,7 @@ import net.minecraft.world.entity.monster.Slime;
public class PlayerMoveControl extends MoveControl { public class PlayerMoveControl extends MoveControl {
protected LivingEntity a; protected LivingEntity a;
private int h; private int jumpTicks;
protected boolean moving; protected boolean moving;
protected double speed; protected double speed;
protected double tx; protected double tx;
@ -31,10 +31,6 @@ public class PlayerMoveControl extends MoveControl {
this.tz = entityinsentient.getZ(); this.tz = entityinsentient.getZ();
} }
protected int cg() {
return new Random().nextInt(20) + 10;
}
@Override @Override
public double getSpeedModifier() { public double getSpeedModifier() {
return this.speed; return this.speed;
@ -60,6 +56,10 @@ public class PlayerMoveControl extends MoveControl {
return this.moving; return this.moving;
} }
protected int jumpTicks() {
return new Random().nextInt(20) + 10;
}
@Override @Override
protected float rotlerp(float f, float f1, float f2) { protected float rotlerp(float f, float f1, float f2) {
float f3 = Mth.wrapDegrees(f1 - f); float f3 = Mth.wrapDegrees(f1 - f);
@ -92,11 +92,11 @@ public class PlayerMoveControl extends MoveControl {
this.moving = true; this.moving = true;
} }
private boolean shouldSlimeJump() { private boolean shouldJump() {
if (!(this.a instanceof Slime)) { if (!(this.a instanceof Slime)) {
return false; return false;
} }
if (this.h-- <= 0) { if (this.jumpTicks-- <= 0) {
return true; return true;
} }
return false; return false;
@ -115,7 +115,7 @@ public class PlayerMoveControl extends MoveControl {
this.a.zza = 0.0F; this.a.zza = 0.0F;
return; 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)); this.a.setYRot(rotlerp(this.a.getYRot(), f, 90.0F));
NMS.setHeadYaw(a.getBukkitEntity(), this.a.getYRot()); NMS.setHeadYaw(a.getBukkitEntity(), this.a.getYRot());
AttributeInstance speed = this.a.getAttribute(Attributes.MOVEMENT_SPEED); AttributeInstance speed = this.a.getAttribute(Attributes.MOVEMENT_SPEED);
@ -123,9 +123,9 @@ public class PlayerMoveControl extends MoveControl {
float movement = (float) (this.speed * speed.getValue()); float movement = (float) (this.speed * speed.getValue());
this.a.setSpeed(movement); this.a.setSpeed(movement);
this.a.zza = movement; this.a.zza = movement;
if (shouldSlimeJump() || (dY >= NMS.getStepHeight(a.getBukkitEntity()) && dXZ < 1.0D)) { if (shouldJump() || (dY >= NMS.getStepHeight(a.getBukkitEntity()) && dXZ < 1.0D)) {
this.h = cg(); this.jumpTicks = jumpTicks();
this.h /= 3; this.jumpTicks /= 3;
if (this.a instanceof EntityHumanNPC) { if (this.a instanceof EntityHumanNPC) {
((EntityHumanNPC) this.a).getControllerJump().jump(); ((EntityHumanNPC) this.a).getControllerJump().jump();
} else { } else {

View File

@ -527,7 +527,7 @@ public class PlayerNavigation extends PathNavigation {
if (isDone()) if (isDone())
return; return;
Vec3 var0 = this.path.getNextEntityPos(this.mob); 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 this.mob.getMoveControl().setWantedPosition(var0.x, this.level.getBlockState(var1.down()).isAir() ? var0.y
: WalkNodeEvaluator.getFloorLevel(this.level, var1), var0.z, this.speedModifier); : WalkNodeEvaluator.getFloorLevel(this.level, var1), var0.z, this.speedModifier);
} }