From b51a261bd10483a0ec10527f92db2171f4b7f9fc Mon Sep 17 00:00:00 2001 From: StijnSimons Date: Mon, 15 Jul 2019 22:31:55 +0200 Subject: [PATCH] Added entityfollow Hey look i can cntrl + c v --- .../api/utils/ExampleBaritoneControl.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/api/java/baritone/api/utils/ExampleBaritoneControl.java b/src/api/java/baritone/api/utils/ExampleBaritoneControl.java index 2445f634..29e2e9d1 100644 --- a/src/api/java/baritone/api/utils/ExampleBaritoneControl.java +++ b/src/api/java/baritone/api/utils/ExampleBaritoneControl.java @@ -411,6 +411,24 @@ public class ExampleBaritoneControl implements Helper, AbstractGameEventListener logDirect("Following any players"); return true; } + if (msg.startsWith("followentity")) { + String name = msg.substring(12).trim(); + Optional toFollow = Optional.empty(); + for (Entity entity : ctx.world().loadedEntityList) { + String entityName = entity.getName().trim().toLowerCase(); + if (entityName.contains(name) || name.contains(entityName)) { + toFollow = Optional.of(entity); + } + } + if (!toFollow.isPresent()) { + logDirect("Entity not found"); + return true; + } + Entity effectivelyFinal = toFollow.get(); + baritone.getFollowProcess().follow(effectivelyFinal::equals); + logDirect("Following entity " + toFollow.get()); + return true; + } if (msg.startsWith("follow")) { String name = msg.substring(6).trim(); Optional toFollow = Optional.empty();