Merge pull request #554 from StijnSimons/master

FollowEntity and FollowEntities
This commit is contained in:
Leijurv 2019-07-19 16:31:04 -07:00 committed by GitHub
commit 053662d0af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -406,11 +406,34 @@ public class ExampleBaritoneControl implements Helper, AbstractGameEventListener
}
return true;
}
if (msg.startsWith("followentities")) {
baritone.getFollowProcess().follow(Entity.class::isInstance);
logDirect("Following any entities");
return true;
}
if (msg.startsWith("followplayers")) {
baritone.getFollowProcess().follow(EntityPlayer.class::isInstance); // O P P A
logDirect("Following any players");
return true;
}
if (msg.startsWith("followentity")) {
String name = msg.substring(12).trim();
Optional<Entity> 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<Entity> toFollow = Optional.empty();