From 64fdad424f4bed7faae1cdba79f638fa5fec8ef4 Mon Sep 17 00:00:00 2001 From: cattyn Date: Sat, 28 Dec 2024 14:29:05 +0300 Subject: [PATCH] added maximum distance setting for FollowProcess --- src/api/java/baritone/api/Settings.java | 5 +++++ src/main/java/baritone/process/FollowProcess.java | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index d9cb501ef..5ae228a93 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -1225,6 +1225,11 @@ public final class Settings { */ public final Setting followRadius = new Setting<>(3); + /** + * The maximum distance to the entity you're following + */ + public final Setting 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 diff --git a/src/main/java/baritone/process/FollowProcess.java b/src/main/java/baritone/process/FollowProcess.java index b123216a6..49cd5f0b8 100644 --- a/src/main/java/baritone/process/FollowProcess.java +++ b/src/main/java/baritone/process/FollowProcess.java @@ -76,6 +76,10 @@ private boolean followable(Entity entity) { 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); }