allowBreakAnyway should let mining happen

This commit is contained in:
Wagyourtail 2022-12-10 16:35:51 -07:00
parent 93501248cd
commit e09127eadf
No known key found for this signature in database
GPG Key ID: 0D30679891BED858
1 changed files with 19 additions and 6 deletions

View File

@ -102,10 +102,17 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
return null;
}
}
if (!Baritone.settings().allowBreak.value) {
logDirect("Unable to mine when allowBreak is false!");
cancel();
return null;
this.filter = new BlockOptionalMetaLookup(filter.blocks()
.stream()
.filter(e -> Baritone.settings().allowBreakAnyway.value.contains(e.getBlock()))
.toArray(BlockOptionalMeta[]::new));
if (this.filter.blocks().isEmpty()) {
logDirect("Unable to mine when allowBreak is false!");
cancel();
return null;
}
}
updateLoucaSystem();
int mineGoalUpdateInterval = Baritone.settings().mineGoalUpdateInterval.value;
@ -467,9 +474,15 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
public void mine(int quantity, BlockOptionalMetaLookup filter) {
this.filter = filter;
if (filter != null && !Baritone.settings().allowBreak.value) {
logDirect("Unable to mine when allowBreak is false!");
this.mine(quantity, (BlockOptionalMetaLookup) null);
return;
this.filter = new BlockOptionalMetaLookup(filter.blocks()
.stream()
.filter(e -> Baritone.settings().allowBreakAnyway.value.contains(e.getBlock()))
.toArray(BlockOptionalMeta[]::new));
if (this.filter.blocks().isEmpty()) {
logDirect("Unable to mine when allowBreak is false!");
this.mine(quantity, (BlockOptionalMetaLookup) null);
return;
}
}
this.desiredQuantity = quantity;
this.knownOreLocations = new ArrayList<>();