From 9334cf1dd45b30c98c3d874234eb90ec40d3f230 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 11 Sep 2018 18:33:03 -0700 Subject: [PATCH] stop walking into liquids, fixes #155 --- src/main/java/baritone/cache/ChunkPacker.java | 2 +- src/main/java/baritone/pathing/movement/MovementHelper.java | 3 ++- .../baritone/pathing/movement/movements/MovementParkour.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/baritone/cache/ChunkPacker.java b/src/main/java/baritone/cache/ChunkPacker.java index 7167df34..9dffe5ae 100644 --- a/src/main/java/baritone/cache/ChunkPacker.java +++ b/src/main/java/baritone/cache/ChunkPacker.java @@ -152,7 +152,7 @@ public final class ChunkPacker implements Helper { return PathingBlockType.WATER; } - if (MovementHelper.avoidWalkingInto(block) || block.equals(Blocks.FLOWING_WATER) || MovementHelper.isBottomSlab(state)) { + if (MovementHelper.avoidWalkingInto(block) || block == Blocks.FLOWING_WATER || MovementHelper.isBottomSlab(state)) { return PathingBlockType.AVOID; } // We used to do an AABB check here diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 6aab4bd5..3f68cba6 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -209,7 +209,8 @@ public interface MovementHelper extends ActionCosts, Helper { } static boolean avoidWalkingInto(Block block) { - return BlockStateInterface.isLava(block) + return block instanceof BlockLiquid + || block instanceof BlockDynamicLiquid || block == Blocks.MAGMA || block == Blocks.CACTUS || block == Blocks.FIRE diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index 07126ca1..24f8883f 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -52,7 +52,7 @@ public class MovementParkour extends Movement { } BlockPos adjBlock = src.down().offset(dir); IBlockState adj = BlockStateInterface.get(adjBlock); - if (MovementHelper.avoidWalkingInto(adj.getBlock())) { // magma sucks + if (MovementHelper.avoidWalkingInto(adj.getBlock()) && adj.getBlock() != Blocks.WATER && adj.getBlock() != Blocks.FLOWING_WATER) { // magma sucks return null; } if (MovementHelper.canWalkOn(adjBlock, adj)) { // don't parkour if we could just traverse (for now)