Skip to content

Commit

Permalink
fix Walk+Follow commands in 1.14+1.15, fixes #2090
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Dec 14, 2019
1 parent b4302c1 commit 58eb522
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Expand Up @@ -306,8 +306,6 @@ public void setSpeed(Entity entity, double speed) {
nmsEntity.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(speed);
}

static final int MAX_ITERATIONS = 100000; // TODO: 1.14.4: Is this name choice correct? Is the value reasonable?

@Override
public void follow(final Entity target, final Entity follower, final double speed, final double lead,
final double maxRange, final boolean allowWander) {
Expand Down Expand Up @@ -350,15 +348,15 @@ public void run() {
}
else {
inRadius = false;
path = followerNavigation.a(targetLocation.getX(), targetLocation.getY(), targetLocation.getZ(), MAX_ITERATIONS);
path = followerNavigation.a(targetLocation.getX(), targetLocation.getY(), targetLocation.getZ(), 0);
if (path != null) {
followerNavigation.a(path, 1D);
followerNavigation.a(2D);
}
}
}
else if (!inRadius && !Utilities.checkLocation(targetLocation, follower.getLocation(), lead)) {
path = followerNavigation.a(targetLocation.getX(), targetLocation.getY(), targetLocation.getZ(), MAX_ITERATIONS);
path = followerNavigation.a(targetLocation.getX(), targetLocation.getY(), targetLocation.getZ(), 0);
if (path != null) {
followerNavigation.a(path, 1D);
followerNavigation.a(2D);
Expand Down Expand Up @@ -394,7 +392,7 @@ public void walkTo(final Entity entity, Location location, double speed, final R
toggleAI(entity, true);
nmsEntity.onGround = true;
}
path = entityNavigation.a(location.getX(), location.getY(), location.getZ(), MAX_ITERATIONS);
path = entityNavigation.a(location.getX(), location.getY(), location.getZ(), 0);
if (path != null) {
entityNavigation.a(path, 1D);
entityNavigation.a(2D);
Expand Down
Expand Up @@ -306,8 +306,6 @@ public void setSpeed(Entity entity, double speed) {
nmsEntity.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(speed);
}

static final int MAX_ITERATIONS = 100000; // TODO: 1.14.4: Is this name choice correct? Is the value reasonable?

@Override
public void follow(final Entity target, final Entity follower, final double speed, final double lead,
final double maxRange, final boolean allowWander) {
Expand Down Expand Up @@ -350,15 +348,15 @@ public void run() {
}
else {
inRadius = false;
path = followerNavigation.a(targetLocation.getX(), targetLocation.getY(), targetLocation.getZ(), MAX_ITERATIONS);
path = followerNavigation.a(targetLocation.getX(), targetLocation.getY(), targetLocation.getZ(), 0);
if (path != null) {
followerNavigation.a(path, 1D);
followerNavigation.a(2D);
}
}
}
else if (!inRadius && !Utilities.checkLocation(targetLocation, follower.getLocation(), lead)) {
path = followerNavigation.a(targetLocation.getX(), targetLocation.getY(), targetLocation.getZ(), MAX_ITERATIONS);
path = followerNavigation.a(targetLocation.getX(), targetLocation.getY(), targetLocation.getZ(), 0);
if (path != null) {
followerNavigation.a(path, 1D);
followerNavigation.a(2D);
Expand Down Expand Up @@ -394,7 +392,7 @@ public void walkTo(final Entity entity, Location location, double speed, final R
toggleAI(entity, true);
nmsEntity.onGround = true;
}
path = entityNavigation.a(location.getX(), location.getY(), location.getZ(), MAX_ITERATIONS);
path = entityNavigation.a(location.getX(), location.getY(), location.getZ(), 0);
if (path != null) {
entityNavigation.a(path, 1D);
entityNavigation.a(2D);
Expand Down

0 comments on commit 58eb522

Please sign in to comment.