From a45f291d6721170cb7b802ba466b59d7982c5c26 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 4 Sep 2018 16:19:10 -0700 Subject: [PATCH] vine and ladder fixes --- .../movement/movements/MovementTraverse.java | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java index af0b7b27..12eda431 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java @@ -57,15 +57,16 @@ public class MovementTraverse extends Movement { IBlockState pb0 = BlockStateInterface.get(positionsToBreak[0]); IBlockState pb1 = BlockStateInterface.get(positionsToBreak[1]); IBlockState destOn = BlockStateInterface.get(positionToPlace); + Block srcDown = BlockStateInterface.getBlock(src.down()); if (MovementHelper.canWalkOn(positionToPlace, destOn)) {//this is a walk, not a bridge double WC = WALK_ONE_BLOCK_COST; if (BlockStateInterface.isWater(pb0.getBlock()) || BlockStateInterface.isWater(pb1.getBlock())) { WC = WALK_ONE_IN_WATER_COST; } else { - if (Blocks.SOUL_SAND.equals(destOn.getBlock())) { + if (destOn.getBlock() == Blocks.SOUL_SAND) { WC += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2; } - if (Blocks.SOUL_SAND.equals(BlockStateInterface.get(src.down()).getBlock())) { + if (srcDown == Blocks.SOUL_SAND) { WC += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2; } } @@ -82,9 +83,12 @@ public class MovementTraverse extends Movement { } return WC; } + if (srcDown == Blocks.LADDER || srcDown == Blocks.VINE) { + hardness1 *= 5; + hardness2 *= 5; + } return WC + hardness1 + hardness2; } else {//this is a bridge, so we need to place a block - Block srcDown = BlockStateInterface.get(src.down()).getBlock(); if (srcDown == Blocks.LADDER || srcDown == Blocks.VINE) { return COST_INF; } @@ -130,6 +134,8 @@ public class MovementTraverse extends Movement { return state; } + state.setInput(InputOverrideHandler.Input.SNEAK, false); + Block fd = BlockStateInterface.get(src.down()).getBlock(); boolean ladder = fd instanceof BlockLadder || fd instanceof BlockVine; IBlockState pb0 = BlockStateInterface.get(positionsToBreak[0]); @@ -186,7 +192,7 @@ public class MovementTraverse extends Movement { state.setInput(InputOverrideHandler.Input.SPRINT, true); } Block destDown = BlockStateInterface.get(dest.down()).getBlock(); - if (ladder && (destDown instanceof BlockVine || destDown instanceof BlockLadder)) { + if (whereAmI.getY() != dest.getY() && ladder && (destDown instanceof BlockVine || destDown instanceof BlockLadder)) { new MovementPillar(dest.down(), dest).updateState(state); // i'm sorry return state; } @@ -264,4 +270,15 @@ public class MovementTraverse extends Movement { } } } + + @Override + protected boolean prepared(MovementState state) { + if (playerFeet().equals(src) || playerFeet().equals(src.down())) { + Block block = BlockStateInterface.getBlock(src.down()); + if (block == Blocks.LADDER || block == Blocks.VINE) { + state.setInput(InputOverrideHandler.Input.SNEAK, true); + } + } + return super.prepared(state); + } }