From 40dfed7e9de403c9ace295bc84e5156fb86be5be Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 13 Aug 2018 13:18:42 -0700 Subject: [PATCH] hopefully deal with soul sand properly --- .../bot/pathing/movement/movements/MovementAscend.java | 7 ++++++- .../bot/pathing/movement/movements/MovementDescend.java | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/bot/pathing/movement/movements/MovementAscend.java b/src/main/java/baritone/bot/pathing/movement/movements/MovementAscend.java index bccced367..0f40f5f03 100644 --- a/src/main/java/baritone/bot/pathing/movement/movements/MovementAscend.java +++ b/src/main/java/baritone/bot/pathing/movement/movements/MovementAscend.java @@ -29,6 +29,7 @@ import baritone.bot.utils.Utils; import net.minecraft.block.BlockFalling; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; @@ -83,8 +84,12 @@ public class MovementAscend extends Movement { if (BlockStateInterface.get(src.up(3)).getBlock() instanceof BlockFalling) {//it would fall on us and possibly suffocate us return COST_INF; } + double halfWalk = WALK_ONE_BLOCK_COST / 2; + if (toPlace.getBlock().equals(Blocks.SOUL_SAND)) { + halfWalk *= SNEAK_ONE_BLOCK_COST / WALK_ONE_BLOCK_COST; + } // we walk half the block to get to the edge, then we walk the other half while simultaneously jumping (math.max because of how it's in parallel) - return WALK_ONE_BLOCK_COST / 2 + Math.max(JUMP_ONE_BLOCK_COST, WALK_ONE_BLOCK_COST / 2) + getTotalHardnessOfBlocksToBreak(context.getToolSet()); + return halfWalk + Math.max(JUMP_ONE_BLOCK_COST, halfWalk) + getTotalHardnessOfBlocksToBreak(context.getToolSet()); } @Override 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 45a9d8365..9543a5d56 100644 --- a/src/main/java/baritone/bot/pathing/movement/movements/MovementDescend.java +++ b/src/main/java/baritone/bot/pathing/movement/movements/MovementDescend.java @@ -27,6 +27,7 @@ import baritone.bot.utils.BlockStateInterface; import net.minecraft.block.Block; import net.minecraft.block.BlockLadder; import net.minecraft.block.BlockVine; +import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; public class MovementDescend extends Movement { @@ -45,7 +46,11 @@ public class MovementDescend extends Movement { return COST_INF; } // we walk half the block plus 0.3 to get to the edge, then we walk the other 0.2 while simultaneously falling (math.max because of how it's in parallel) - return WALK_ONE_BLOCK_COST * 0.8 + Math.max(FALL_N_BLOCKS_COST[1], WALK_ONE_BLOCK_COST * 0.2) + getTotalHardnessOfBlocksToBreak(context.getToolSet()); + double walk = WALK_OFF_BLOCK_COST; + if (BlockStateInterface.get(src.down()).getBlock().equals(Blocks.SOUL_SAND)) { + walk *= WALK_ONE_BLOCK_COST / SNEAK_ONE_BLOCK_COST; + } + return walk + Math.max(FALL_N_BLOCKS_COST[1], CENTER_AFTER_FALL_COST) + getTotalHardnessOfBlocksToBreak(context.getToolSet()); } int numTicks = 0;