From e09127eadf3efe6aee9afd56183c902181737c57 Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Sat, 10 Dec 2022 16:35:51 -0700 Subject: [PATCH] allowBreakAnyway should let mining happen --- .../java/baritone/process/MineProcess.java | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/main/java/baritone/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java index 1ec47cd92..08a6791b6 100644 --- a/src/main/java/baritone/process/MineProcess.java +++ b/src/main/java/baritone/process/MineProcess.java @@ -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<>();