From b47b8134629da054287c8eb99927ac53a8aa7070 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 18 Sep 2018 12:23:03 -0700 Subject: [PATCH] deal with fence gate properly, fixes #172 --- .../pathing/movement/movements/MovementPillar.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java index 99b3aa50..512ff937 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java @@ -67,20 +67,25 @@ public class MovementPillar extends Movement { return COST_INF; } } - double hardness = getTotalHardnessOfBlocksToBreak(context); + BlockPos toBreakPos = src.up(2); + IBlockState toBreak = BlockStateInterface.get(toBreakPos); + Block toBreakBlock = toBreak.getBlock(); + if (toBreakBlock instanceof BlockFenceGate) { + return COST_INF; + } + double hardness = MovementHelper.getMiningDurationTicks(context, toBreakPos, toBreak, true); if (hardness >= COST_INF) { return COST_INF; } if (hardness != 0) { - Block tmp = BlockStateInterface.get(src.up(2)).getBlock(); - if (tmp instanceof BlockLadder || tmp instanceof BlockVine) { + if (toBreakBlock instanceof BlockLadder || toBreakBlock instanceof BlockVine) { hardness = 0; // we won't actually need to break the ladder / vine because we're going to use it } else { BlockPos chkPos = src.up(3); IBlockState check = BlockStateInterface.get(chkPos); if (check.getBlock() instanceof BlockFalling) { // see MovementAscend's identical check for breaking a falling block above our head - if (!(tmp instanceof BlockFalling) || !(BlockStateInterface.get(src.up(1)).getBlock() instanceof BlockFalling)) { + if (!(toBreakBlock instanceof BlockFalling) || !(BlockStateInterface.get(src.up(1)).getBlock() instanceof BlockFalling)) { return COST_INF; } }