From d94e825a798f5aba87fe8a4eea16c8114c0f88a6 Mon Sep 17 00:00:00 2001 From: leijurv Date: Fri, 17 Aug 2018 21:02:41 -0700 Subject: [PATCH] iron doors, fixes #30 --- .../baritone/bot/pathing/movement/MovementHelper.java | 5 +++-- .../bot/pathing/movement/movements/MovementTraverse.java | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/baritone/bot/pathing/movement/MovementHelper.java b/src/main/java/baritone/bot/pathing/movement/MovementHelper.java index 2587261d..90e4c4c8 100644 --- a/src/main/java/baritone/bot/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/bot/pathing/movement/MovementHelper.java @@ -47,13 +47,14 @@ public interface MovementHelper extends ActionCosts, Helper { Block b = state.getBlock(); BlockPos below = new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ()); return Blocks.ICE.equals(b) // ice becomes water, and water can mess up the path - || b instanceof BlockSilverfish + || 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 || BlockStateInterface.isLiquid(new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ())) || 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 + // TODO revisit this. why is it not okay to break non-lilypads that are right above water? } /** @@ -78,7 +79,7 @@ public interface MovementHelper extends ActionCosts, Helper { if (BlockStateInterface.isFlowing(state) || BlockStateInterface.isLiquid(pos.up())) { return false; // Don't walk through flowing liquids } - if (block instanceof BlockDoor) { + if (block instanceof BlockDoor && !Blocks.IRON_DOOR.equals(block)) { return true; // we can just open the door } return block.isPassable(mc.world, pos); diff --git a/src/main/java/baritone/bot/pathing/movement/movements/MovementTraverse.java b/src/main/java/baritone/bot/pathing/movement/movements/MovementTraverse.java index 50c4b5a6..33123372 100644 --- a/src/main/java/baritone/bot/pathing/movement/movements/MovementTraverse.java +++ b/src/main/java/baritone/bot/pathing/movement/movements/MovementTraverse.java @@ -146,9 +146,11 @@ public class MovementTraverse extends Movement { isDoorActuallyBlockingUs = true; } if (isDoorActuallyBlockingUs) { - state.setTarget(new MovementState.MovementTarget(Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(positionsToBreak[0], world())))); - state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true); - return state; + if (!(Blocks.IRON_DOOR.equals(srcBlock) || Blocks.IRON_DOOR.equals(pb0.getBlock()) || Blocks.IRON_DOOR.equals(pb1.getBlock()))) { + state.setTarget(new MovementState.MovementTarget(Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(positionsToBreak[0], world())))); + state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true); + return state; + } } } boolean isTheBridgeBlockThere = MovementHelper.canWalkOn(positionsToPlace[0]) || ladder;