Fix pathfinding NPE

This commit is contained in:
Felix Cravic 2020-11-29 17:27:24 +01:00
parent bb3d57b1e5
commit cabdb60370
2 changed files with 6 additions and 7 deletions

View File

@ -137,7 +137,9 @@ public abstract class EntityCreature extends LivingEntity {
if (path != null) {
final float speed = getAttributeValue(Attributes.MOVEMENT_SPEED);
final Position targetPosition = pathingEntity.getTargetPosition();
moveTowards(targetPosition, speed);
if (targetPosition != null) {
moveTowards(targetPosition, speed);
}
} else {
if (pathPosition != null) {
this.pathPosition = null;

View File

@ -188,12 +188,9 @@ public class PFPathingEntity implements IPathingEntity {
final float z = (float) position.z;
this.targetPosition = new Position(x, y, z);
// Jump for non-flying entities
if (!avian) {
final float entityY = entity.getPosition().getY();
if (entityY < y) {
entity.jump(1);
}
final float entityY = entity.getPosition().getY();
if (entityY < y) {
entity.jump(1);
}
}