From 1ca736692d889bf3ed2fbdd8225b84995724b824 Mon Sep 17 00:00:00 2001 From: wagyourtail Date: Fri, 15 Oct 2021 17:58:13 -0600 Subject: [PATCH] more closely match the existing docs and add discourageBreaking --- src/api/java/baritone/api/Settings.java | 11 +++++++++-- .../baritone/pathing/movement/MovementHelper.java | 3 ++- src/main/java/baritone/utils/ToolSet.java | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index c8dc1b9e..7ca050ce 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -201,9 +201,16 @@ public final class Settings { ))); /** - * make {@link #blocksToAvoidBreaking} mean the block is never broken instead of just strongly discouraging it. + * blocks that baritone shouldn't break, but can if it needs to. */ - public final Setting avoidBreakingMeansNever = new Setting(false); + public final Setting> blocksToDiscourageBreaking = new Setting<>(new ArrayList<>(Arrays.asList( + + ))); + + /** + * this multiplies the break speed, if set above 1 it's "encourage breaking" instead + */ + public final Setting discourageBreakingMultiplier = new Setting<>(.1); /** * A list of blocks to be treated as if they're air. diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 69e846a2..64528ddd 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -50,7 +50,8 @@ public interface MovementHelper extends ActionCosts, Helper { static boolean avoidBreaking(BlockStateInterface bsi, int x, int y, int z, IBlockState state) { Block b = state.getBlock(); - return b == Blocks.ICE // ice becomes water, and water can mess up the path + return Baritone.settings().blocksToAvoidBreaking.value.contains(b) + || b == Blocks.ICE // ice becomes water, and water can mess up the path || b instanceof BlockSilverfish // obvious reasons // call context.get directly with x,y,z. no need to make 5 new BlockPos for no reason || avoidAdjacentBreaking(bsi, x, y + 1, z, true) diff --git a/src/main/java/baritone/utils/ToolSet.java b/src/main/java/baritone/utils/ToolSet.java index 31046a87..d99adbb3 100644 --- a/src/main/java/baritone/utils/ToolSet.java +++ b/src/main/java/baritone/utils/ToolSet.java @@ -165,7 +165,7 @@ public class ToolSet { } private double avoidanceMultiplier(Block b) { - return Baritone.settings().blocksToAvoidBreaking.value.contains(b) ? Baritone.settings().avoidBreakingMeansNever.value ? 0 : 0.1 : 1; + return Baritone.settings().blocksToDiscourageBreaking.value.contains(b) ? Baritone.settings().discourageBreakingMultiplier.value : 1; } /**