added maximum distance setting for FollowProcess

This commit is contained in:
cattyn
2024-12-28 14:29:05 +03:00
parent a5668532b1
commit 64fdad424f
2 changed files with 9 additions and 0 deletions

View File

@@ -1225,6 +1225,11 @@ public final class Settings {
*/
public final Setting<Integer> followRadius = new Setting<>(3);
/**
* The maximum distance to the entity you're following
*/
public final Setting<Integer> followTargetMaxDistance = new Setting<>(0);
/**
* Turn this on if your exploration filter is enormous, you don't want it to check if it's done,
* and you are just fine with it just hanging on completion

View File

@@ -76,6 +76,10 @@ public final class FollowProcess extends BaritoneProcessHelper implements IFollo
if (entity.equals(ctx.player())) {
return false;
}
int maxDist = Baritone.settings().followTargetMaxDistance.value;
if (maxDist != 0 && entity.distanceToSqr(ctx.player()) > maxDist * maxDist) {
return false;
}
return ctx.entitiesStream().anyMatch(entity::equals);
}