mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 10:36:10 +01:00
Adjust minecraft pathfinder to look less frequently and pathfind closer to destination in players
This commit is contained in:
parent
cd652db2f7
commit
318596c715
@ -36,7 +36,7 @@
|
||||
</repository>
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sk89q-repo</id>
|
||||
|
@ -86,8 +86,8 @@ public class MCNavigationStrategy extends AbstractPathStrategy {
|
||||
double dX = target.getX() - loc.getX();
|
||||
double dZ = target.getZ() - loc.getZ();
|
||||
double dY = target.getY() - loc.getY();
|
||||
double xzDistance = dX * dX + dZ * dZ;
|
||||
if (Math.abs(dY) < 1 && Math.sqrt(xzDistance) <= parameters.distanceMargin()) {
|
||||
double xzDistance = Math.sqrt(dX * dX + dZ * dZ);
|
||||
if (Math.abs(dY) < 1 && xzDistance <= parameters.distanceMargin()) {
|
||||
stop();
|
||||
return true;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>everything</id>
|
||||
<url>http://repo.citizensnpcs.co</url>
|
||||
<url>https://repo.citizensnpcs.co</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>everything</id>
|
||||
<url>http://repo.citizensnpcs.co</url>
|
||||
<url>https://repo.citizensnpcs.co</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>everything</id>
|
||||
<url>http://repo.citizensnpcs.co</url>
|
||||
<url>https://repo.citizensnpcs.co</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>everything</id>
|
||||
<url>http://repo.citizensnpcs.co</url>
|
||||
<url>https://repo.citizensnpcs.co</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>everything</id>
|
||||
<url>http://repo.citizensnpcs.co</url>
|
||||
<url>https://repo.citizensnpcs.co</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>everything</id>
|
||||
<url>http://repo.citizensnpcs.co</url>
|
||||
<url>https://repo.citizensnpcs.co</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>everything</id>
|
||||
<url>http://repo.citizensnpcs.co</url>
|
||||
<url>https://repo.citizensnpcs.co</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>everything</id>
|
||||
<url>http://repo.citizensnpcs.co</url>
|
||||
<url>https://repo.citizensnpcs.co</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
@ -110,14 +110,16 @@ public class PlayerMoveControl extends MoveControl {
|
||||
double dX = this.tx - this.entity.getX();
|
||||
double dZ = this.tz - this.entity.getZ();
|
||||
double dY = this.ty - this.entity.getY();
|
||||
double dXZ = dX * dX + dZ * dZ;
|
||||
if (Math.abs(dY) < 1.0 && dXZ < 0.0075) {
|
||||
double dXZ = Math.sqrt(dX * dX + dZ * dZ);
|
||||
if (Math.abs(dY) < 1.0 && dXZ < 0.01) {
|
||||
this.entity.zza = 0.0F;
|
||||
return;
|
||||
}
|
||||
float f = (float) (Mth.atan2(dZ, dX) * 57.2957763671875D) - 90.0F;
|
||||
this.entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F));
|
||||
NMS.setHeadYaw(entity.getBukkitEntity(), this.entity.getYRot());
|
||||
if (dXZ > 0.4) {
|
||||
float f = (float) (Mth.atan2(dZ, dX) * 57.2957763671875D) - 90.0F;
|
||||
this.entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F));
|
||||
NMS.setHeadYaw(entity.getBukkitEntity(), this.entity.getYRot());
|
||||
}
|
||||
AttributeInstance speed = this.entity.getAttribute(Attributes.MOVEMENT_SPEED);
|
||||
float movement = (float) (this.speed * speed.getValue());
|
||||
this.entity.setSpeed(movement);
|
||||
|
@ -18,7 +18,7 @@
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>everything</id>
|
||||
<url>http://repo.citizensnpcs.co</url>
|
||||
<url>https://repo.citizensnpcs.co</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
@ -110,13 +110,15 @@ public class PlayerMoveControl extends MoveControl {
|
||||
double dZ = this.tz - this.entity.getZ();
|
||||
double dY = this.ty - this.entity.getY();
|
||||
double dXZ = Math.sqrt(dX * dX + dZ * dZ);
|
||||
if (Math.abs(dY) < 1.0 && dXZ < 0.09) {
|
||||
if (Math.abs(dY) < 1.0 && dXZ < 0.01) {
|
||||
// this.entity.zza = 0.0F;
|
||||
return;
|
||||
}
|
||||
float f = (float) Math.toDegrees(Mth.atan2(dZ, dX)) - 90.0F;
|
||||
this.entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F));
|
||||
NMS.setHeadYaw(entity.getBukkitEntity(), this.entity.getYRot());
|
||||
if (dXZ > 0.4) {
|
||||
float f = (float) Math.toDegrees(Mth.atan2(dZ, dX)) - 90.0F;
|
||||
this.entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F));
|
||||
NMS.setHeadYaw(entity.getBukkitEntity(), this.entity.getYRot());
|
||||
}
|
||||
float movement = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
|
||||
this.entity.setSpeed(movement);
|
||||
this.entity.zza = movement;
|
||||
|
@ -16,7 +16,7 @@
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>everything</id>
|
||||
<url>http://repo.citizensnpcs.co</url>
|
||||
<url>https://repo.citizensnpcs.co</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
@ -84,6 +84,7 @@ public class PlayerMoveControl extends MoveControl {
|
||||
|
||||
@Override
|
||||
public void setWantedPosition(double d0, double d1, double d2, double d3) {
|
||||
System.out.println("set pos: " + d0 + " " + d2);
|
||||
this.tx = d0;
|
||||
this.ty = d1;
|
||||
this.tz = d2;
|
||||
@ -110,13 +111,15 @@ public class PlayerMoveControl extends MoveControl {
|
||||
double dZ = this.tz - this.entity.getZ();
|
||||
double dY = this.ty - this.entity.getY();
|
||||
double dXZ = Math.sqrt(dX * dX + dZ * dZ);
|
||||
if (Math.abs(dY) < 1.0 && dXZ < 0.09) {
|
||||
if (Math.abs(dY) < 1.0 && dXZ < 0.01) {
|
||||
// this.entity.zza = 0.0F;
|
||||
return;
|
||||
}
|
||||
float f = (float) Math.toDegrees(Mth.atan2(dZ, dX)) - 90.0F;
|
||||
this.entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F));
|
||||
NMS.setHeadYaw(entity.getBukkitEntity(), this.entity.getYRot());
|
||||
if (dXZ > 0.4) {
|
||||
float f = (float) Math.toDegrees(Mth.atan2(dZ, dX)) - 90.0F;
|
||||
this.entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F));
|
||||
NMS.setHeadYaw(entity.getBukkitEntity(), this.entity.getYRot());
|
||||
}
|
||||
float movement = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
|
||||
this.entity.setSpeed(movement);
|
||||
this.entity.zza = movement;
|
||||
|
@ -147,7 +147,7 @@ public class PlayerNavigation extends PathNavigation {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private boolean canWalkOn(int var0, int var1, int var2, int var3, int var4, int var5, Vec3 var6, double var7,
|
||||
double var9) {
|
||||
int var11 = var0 - var3 / 2;
|
||||
|
@ -18,7 +18,7 @@
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>everything</id>
|
||||
<url>http://repo.citizensnpcs.co</url>
|
||||
<url>https://repo.citizensnpcs.co</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user