From 49658078b9cdd932d597bfc83c078ce444f3b1f9 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 18 Mar 2019 22:38:06 -0700 Subject: [PATCH] trapdoors cant be passed vertically in either state, thanks plutie --- .../pathing/movement/MovementHelper.java | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 47677a65..12ab8e72 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -72,7 +72,7 @@ public interface MovementHelper extends ActionCosts, Helper { if (block == Blocks.AIR) { // early return for most common case return true; } - if (block == Blocks.FIRE || block == Blocks.TRIPWIRE || block == Blocks.WEB || block == Blocks.END_PORTAL || block == Blocks.COCOA || block instanceof BlockSkull) { + if (block == Blocks.FIRE || block == Blocks.TRIPWIRE || block == Blocks.WEB || block == Blocks.END_PORTAL || block == Blocks.COCOA || block instanceof BlockSkull || block instanceof BlockTrapDoor) { return false; } if (block instanceof BlockDoor || block instanceof BlockFenceGate) { @@ -84,9 +84,7 @@ public interface MovementHelper extends ActionCosts, Helper { if (block == Blocks.CARPET) { return canWalkOn(bsi, x, y - 1, z); } - boolean snow = block instanceof BlockSnow; - boolean trapdoor = block instanceof BlockTrapDoor; - if (snow || trapdoor) { + if (block instanceof BlockSnow) { // we've already checked doors and fence gates // so the only remaining dynamic isPassables are snow and trapdoor // if they're cached as a top block, we don't know their metadata @@ -94,19 +92,13 @@ public interface MovementHelper extends ActionCosts, Helper { if (!bsi.worldContainsLoadedChunk(x, z)) { return true; } - if (snow) { - // the check in BlockSnow.isPassable is layers < 5 - // while actually, we want < 3 because 3 or greater makes it impassable in a 2 high ceiling - if (state.getValue(BlockSnow.LAYERS) >= 3) { - return false; - } - // ok, it's low enough we could walk through it, but is it supported? - return canWalkOn(bsi, x, y - 1, z); + // the check in BlockSnow.isPassable is layers < 5 + // while actually, we want < 3 because 3 or greater makes it impassable in a 2 high ceiling + if (state.getValue(BlockSnow.LAYERS) >= 3) { + return false; } - if (trapdoor) { - return !state.getValue(BlockTrapDoor.OPEN); // see BlockTrapDoor.isPassable - } - throw new IllegalStateException(); + // ok, it's low enough we could walk through it, but is it supported? + return canWalkOn(bsi, x, y - 1, z); } if (isFlowing(x, y, z, state, bsi)) { return false; // Don't walk through flowing liquids