crucial performance optimization

This commit is contained in:
Leijurv 2019-04-06 21:50:22 -08:00
parent 87a9e67ba8
commit 867c01ff86
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -84,7 +84,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
boolean shouldCancel = calcFailed; boolean shouldCancel = calcFailed;
if (calcFailed && !knownOreLocations.isEmpty() && Baritone.settings().blacklistClosestOnFailure.value) { if (calcFailed && !knownOreLocations.isEmpty() && Baritone.settings().blacklistClosestOnFailure.value) {
logDirect("Unable to find any path to " + mining + ", blacklisting presumably unreachable closest instance..."); logDirect("Unable to find any path to " + mining + ", blacklisting presumably unreachable closest instance...");
knownOreLocations.stream().sorted(Comparator.comparingDouble(ctx.player()::getDistanceSq)).findFirst().ifPresent(blacklist::add); knownOreLocations.stream().min(Comparator.comparingDouble(ctx.player()::getDistanceSq)).ifPresent(blacklist::add);
knownOreLocations.removeIf(blacklist::contains); knownOreLocations.removeIf(blacklist::contains);
shouldCancel = false; // 😎 shouldCancel = false; // 😎
} }