hopefully deal with soul sand properly

This commit is contained in:
Leijurv 2018-08-13 13:18:42 -07:00
parent dbca100e55
commit 40dfed7e9d
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 12 additions and 2 deletions

View File

@ -29,6 +29,7 @@ import baritone.bot.utils.Utils;
import net.minecraft.block.BlockFalling; import net.minecraft.block.BlockFalling;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; 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 if (BlockStateInterface.get(src.up(3)).getBlock() instanceof BlockFalling) {//it would fall on us and possibly suffocate us
return COST_INF; 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) // 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 @Override

View File

@ -27,6 +27,7 @@ import baritone.bot.utils.BlockStateInterface;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockLadder; import net.minecraft.block.BlockLadder;
import net.minecraft.block.BlockVine; import net.minecraft.block.BlockVine;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
public class MovementDescend extends Movement { public class MovementDescend extends Movement {
@ -45,7 +46,11 @@ public class MovementDescend extends Movement {
return COST_INF; 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) // 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; int numTicks = 0;