diff --git a/src/main/java/baritone/bot/pathing/calc/AbstractNodeCostSearch.java b/src/main/java/baritone/bot/pathing/calc/AbstractNodeCostSearch.java index e1b56187..65eefd6a 100644 --- a/src/main/java/baritone/bot/pathing/calc/AbstractNodeCostSearch.java +++ b/src/main/java/baritone/bot/pathing/calc/AbstractNodeCostSearch.java @@ -57,7 +57,7 @@ public abstract class AbstractNodeCostSearch implements IPathFinder { * * @see */ - protected static final double[] COEFFICIENTS = {1.5, 2, 2.5, 3, 4, 5, 10}; + protected static final double[] COEFFICIENTS = {1, 1.5, 2, 2.5, 3, 4, 5, 10}; /** * If a path goes less than 5 blocks and doesn't make it to its goal, it's not worth considering. */ diff --git a/src/main/java/baritone/bot/pathing/goals/GoalXZ.java b/src/main/java/baritone/bot/pathing/goals/GoalXZ.java index 8b3ad4c6..37cb694a 100644 --- a/src/main/java/baritone/bot/pathing/goals/GoalXZ.java +++ b/src/main/java/baritone/bot/pathing/goals/GoalXZ.java @@ -23,6 +23,7 @@ import net.minecraft.util.math.Vec3d; /** * Useful for long-range goals that don't have a specific Y level. + * * @author leijurv */ public class GoalXZ implements Goal { @@ -97,7 +98,7 @@ public class GoalXZ implements Goal { diagonal = z; } diagonal *= SQRT_2; - return (diagonal + straight) * WALK_ONE_BLOCK_COST; + return (diagonal + straight) * 4; } public static GoalXZ fromDirection(Vec3d origin, float yaw, double distance) { diff --git a/src/main/java/baritone/bot/pathing/movement/ActionCosts.java b/src/main/java/baritone/bot/pathing/movement/ActionCosts.java index fcad68df..e92af895 100644 --- a/src/main/java/baritone/bot/pathing/movement/ActionCosts.java +++ b/src/main/java/baritone/bot/pathing/movement/ActionCosts.java @@ -22,13 +22,13 @@ public interface ActionCosts extends ActionCostsButOnlyTheOnesThatMakeMickeyDieI /** * These costs are measured roughly in ticks btw */ - double WALK_ONE_BLOCK_COST = 20 / 4.317; + double WALK_ONE_BLOCK_COST = 20 / 4.317; // // 4.633 double WALK_ONE_IN_WATER_COST = 20 / 2.2; double JUMP_ONE_BLOCK_COST = 5.72854;//see below calculation for fall. 1.25 blocks double LADDER_UP_ONE_COST = 20 / 2.35; double LADDER_DOWN_ONE_COST = 20 / 3.0; double SNEAK_ONE_BLOCK_COST = 20 / 1.3; - double SPRINT_ONE_BLOCK_COST = 20 / 5.612; + double SPRINT_ONE_BLOCK_COST = 20 / 5.612; // 3.564 /** * To walk off an edge you need to walk 0.5 to the edge then 0.3 to start falling off */ diff --git a/src/main/java/baritone/bot/pathing/movement/movements/MovementDescend.java b/src/main/java/baritone/bot/pathing/movement/movements/MovementDescend.java index d0f36939..578a89b6 100644 --- a/src/main/java/baritone/bot/pathing/movement/movements/MovementDescend.java +++ b/src/main/java/baritone/bot/pathing/movement/movements/MovementDescend.java @@ -68,10 +68,14 @@ public class MovementDescend extends Movement { case RUNNING: BlockPos playerFeet = playerFeet(); - if (playerFeet.equals(dest) && (BlockStateInterface.isLiquid(dest) || player().posY - playerFeet.getY() < 0.01)) { - // Wait until we're actually on the ground before saying we're done because sometimes we continue to fall if the next action starts immediately - state.setStatus(MovementStatus.SUCCESS); - return state; + if (playerFeet.equals(dest)) { + if (BlockStateInterface.isLiquid(dest) || player().posY - playerFeet.getY() < 0.01) { + // Wait until we're actually on the ground before saying we're done because sometimes we continue to fall if the next action starts immediately + state.setStatus(MovementStatus.SUCCESS); + return state; + } else { + System.out.println(player().posY + " " + playerFeet.getY() + " " + (player().posY - playerFeet.getY())); + } } double diffX = player().posX - (dest.getX() + 0.5); double diffZ = player().posZ - (dest.getZ() + 0.5); @@ -79,15 +83,19 @@ public class MovementDescend extends Movement { double x = player().posX - (src.getX() + 0.5); double z = player().posZ - (src.getZ() + 0.5); double fromStart = Math.sqrt(x * x + z * z); - if (!playerFeet.equals(dest) || ab > 0.2) { + if (!playerFeet.equals(dest) || ab > 0.25) { BlockPos fakeDest = new BlockPos(dest.getX() * 2 - src.getX(), dest.getY(), dest.getZ() * 2 - src.getZ()); double diffX2 = player().posX - (fakeDest.getX() + 0.5); double diffZ2 = player().posZ - (fakeDest.getZ() + 0.5); double d = Math.sqrt(diffX2 * diffX2 + diffZ2 * diffZ2); - MovementHelper.moveTowards(state, fakeDest); - if (fromStart > 1.2 && numTicks++ < 10) { - state.setInput(InputOverrideHandler.Input.MOVE_FORWARD, false); - state.setInput(InputOverrideHandler.Input.MOVE_BACK, true); + if (numTicks++ < 20) { + MovementHelper.moveTowards(state, fakeDest); + if (fromStart > 1.25) { + state.setInput(InputOverrideHandler.Input.MOVE_FORWARD, false); + state.setInput(InputOverrideHandler.Input.MOVE_BACK, true); + } + } else { + MovementHelper.moveTowards(state, dest); } } return state; diff --git a/src/main/java/baritone/bot/pathing/path/PathExecutor.java b/src/main/java/baritone/bot/pathing/path/PathExecutor.java index 34f43039..ae14d3d8 100644 --- a/src/main/java/baritone/bot/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/bot/pathing/path/PathExecutor.java @@ -91,6 +91,7 @@ public class PathExecutor implements Helper { if (whereAmI.equals(path.positions().get(i))) { displayChatMessageRaw("Skipping back " + (pathPosition - i) + " steps, to " + i); pathPosition = Math.max(i - 1, 0); // previous step might not actually be done + Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); return false; } } @@ -100,6 +101,7 @@ public class PathExecutor implements Helper { displayChatMessageRaw("Skipping forward " + (i - pathPosition) + " steps, to " + i); } pathPosition = i - 1; + Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); return false; } }