fix behavior when all have been mined
This commit is contained in:
parent
e354227635
commit
aca487f97e
@ -55,11 +55,6 @@ public class MineBehavior extends Behavior {
|
||||
return;
|
||||
}
|
||||
List<BlockPos> locs = new ArrayList<>(WorldProvider.INSTANCE.getCurrentWorld().cache.getLocationsOf(mining, 1, 1));
|
||||
if (locs.isEmpty()) {
|
||||
displayChatMessageRaw("No locations for " + mining + " known, cancelling");
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
BlockPos playerFeet = playerFeet();
|
||||
locs.sort(Comparator.comparingDouble(playerFeet::distanceSq));
|
||||
|
||||
@ -71,6 +66,11 @@ public class MineBehavior extends Behavior {
|
||||
if (locs.size() > 30) {
|
||||
locs = locs.subList(0, 30);
|
||||
}
|
||||
if (locs.isEmpty()) {
|
||||
displayChatMessageRaw("No locations for " + mining + " known, cancelling");
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
PathingBehavior.INSTANCE.setGoal(new GoalComposite(locs.stream().map(GoalTwoBlocks::new).toArray(Goal[]::new)));
|
||||
PathingBehavior.INSTANCE.path();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user