diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index 099493e2..75aaddc9 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -56,6 +56,12 @@ public class Settings { */ public Setting allowWaterBucketFall = new Setting<>(true); + /** + * Allow Baritone to assume it can walk on still water just like any other block. + * This functionality is assumed to be provided by a separate library that might have imported Baritone. + */ + public Setting assumeWalkOnWater = new Setting<>(false); + /** * Blocks that Baritone is allowed to place (as throwaway, for sneak bridging, pillaring, etc.) */ diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 79892bbe..95ded07c 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -48,7 +48,7 @@ public interface MovementHelper extends ActionCosts, Helper { static boolean avoidBreaking(BlockPos pos, IBlockState state) { Block b = state.getBlock(); - BlockPos below = new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ()); + Block below = BlockStateInterface.get(new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ())).getBlock(); return Blocks.ICE.equals(b) // ice becomes water, and water can mess up the path || b instanceof BlockSilverfish // obvious reasons || BlockStateInterface.isLiquid(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ()))//don't break anything touching liquid on any side @@ -56,7 +56,7 @@ public interface MovementHelper extends ActionCosts, Helper { || BlockStateInterface.isLiquid(new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ())) || BlockStateInterface.isLiquid(new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1)) || BlockStateInterface.isLiquid(new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1)) - || (!(b instanceof BlockLilyPad && BlockStateInterface.isWater(below)) && BlockStateInterface.isLiquid(below));//if it's a lilypad above water, it's ok to break, otherwise don't break if its liquid + || (!(b instanceof BlockLilyPad && BlockStateInterface.isWater(below)) && below instanceof BlockLiquid);//if it's a lilypad above water, it's ok to break, otherwise don't break if its liquid // TODO revisit this. why is it not okay to break non-lilypads that are right above water? } @@ -97,6 +97,9 @@ public interface MovementHelper extends ActionCosts, Helper { return false; // Don't walk through flowing liquids } if (block instanceof BlockLiquid) { + if (Baritone.settings().assumeWalkOnWater.get()) { + return false; + } IBlockState up = BlockStateInterface.get(pos.up()); if (up.getBlock() instanceof BlockLiquid || up.getBlock() instanceof BlockLilyPad) { return false; @@ -196,6 +199,12 @@ public interface MovementHelper extends ActionCosts, Helper { return false; } if (BlockStateInterface.isWater(block)) { + if (BlockStateInterface.isFlowing(state)) { + return false; + } + if (Baritone.settings().assumeWalkOnWater.get()) { + return true; + } Block up = BlockStateInterface.get(pos.up()).getBlock(); return BlockStateInterface.isWater(up) || up instanceof BlockLilyPad; // You can only walk on water if there is water above it }