This commit is contained in:
Leijurv 2018-09-03 09:15:18 -07:00
parent 7fd0d5799d
commit bac07ce100
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
11 changed files with 91 additions and 52 deletions

View File

@ -20,10 +20,7 @@ package baritone.chunk;
import baritone.pathing.movement.MovementHelper; import baritone.pathing.movement.MovementHelper;
import baritone.utils.Helper; import baritone.utils.Helper;
import baritone.utils.pathing.PathingBlockType; import baritone.utils.pathing.PathingBlockType;
import net.minecraft.block.Block; import net.minecraft.block.*;
import net.minecraft.block.BlockDoublePlant;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@ -50,10 +47,11 @@ public final class ChunkPacker implements Helper {
for (int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {
for (int x = 0; x < 16; x++) { for (int x = 0; x < 16; x++) {
int index = CachedChunk.getPositionIndex(x, y, z); int index = CachedChunk.getPositionIndex(x, y, z);
Block block = chunk.getBlockState(x, y, z).getBlock(); IBlockState state = chunk.getBlockState(x, y, z);
boolean[] bits = getPathingBlockType(block).getBits(); boolean[] bits = getPathingBlockType(state).getBits();
bitSet.set(index, bits[0]); bitSet.set(index, bits[0]);
bitSet.set(index + 1, bits[1]); bitSet.set(index + 1, bits[1]);
Block block = state.getBlock();
if (CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.contains(block)) { if (CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.contains(block)) {
String name = blockToString(block); String name = blockToString(block);
specialBlocks.computeIfAbsent(name, b -> new ArrayList<>()).add(new BlockPos(x, y, z)); specialBlocks.computeIfAbsent(name, b -> new ArrayList<>()).add(new BlockPos(x, y, z));
@ -103,13 +101,14 @@ public final class ChunkPacker implements Helper {
return Block.getBlockFromName(name); return Block.getBlockFromName(name);
} }
private static PathingBlockType getPathingBlockType(Block block) { private static PathingBlockType getPathingBlockType(IBlockState state) {
Block block = state.getBlock();
if (block.equals(Blocks.WATER)) { if (block.equals(Blocks.WATER)) {
// only water source blocks are plausibly usable, flowing water should be avoid // only water source blocks are plausibly usable, flowing water should be avoid
return PathingBlockType.WATER; return PathingBlockType.WATER;
} }
if (MovementHelper.avoidWalkingInto(block) || block.equals(Blocks.FLOWING_WATER)) { if (MovementHelper.avoidWalkingInto(block) || block.equals(Blocks.FLOWING_WATER) || (block instanceof BlockSlab && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM)) {
return PathingBlockType.AVOID; return PathingBlockType.AVOID;
} }
// We used to do an AABB check here // We used to do an AABB check here

View File

@ -21,13 +21,7 @@ import baritone.Baritone;
import baritone.behavior.impl.LookBehavior; import baritone.behavior.impl.LookBehavior;
import baritone.behavior.impl.LookBehaviorUtils; import baritone.behavior.impl.LookBehaviorUtils;
import baritone.pathing.movement.MovementState.MovementStatus; import baritone.pathing.movement.MovementState.MovementStatus;
import baritone.pathing.movement.movements.MovementDownward;
import baritone.pathing.movement.movements.MovementPillar;
import baritone.pathing.movement.movements.MovementTraverse;
import baritone.utils.*; import baritone.utils.*;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLadder;
import net.minecraft.block.BlockVine;
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.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
@ -78,21 +72,11 @@ public abstract class Movement implements Helper, MovementHelper {
if (cost == null) { if (cost == null) {
if (context == null) if (context == null)
context = new CalculationContext(); context = new CalculationContext();
cost = calculateCost0(context); cost = calculateCost(context);
} }
return cost; return cost;
} }
private double calculateCost0(CalculationContext context) {
if (!(this instanceof MovementPillar) && !(this instanceof MovementTraverse) && !(this instanceof MovementDownward)) {
Block fromDown = BlockStateInterface.get(src.down()).getBlock();
if (fromDown instanceof BlockLadder || fromDown instanceof BlockVine) {
return COST_INF;
}
}
return calculateCost(context);
}
protected abstract double calculateCost(CalculationContext context); protected abstract double calculateCost(CalculationContext context);
public double recalculateCost() { public double recalculateCost() {
@ -101,7 +85,7 @@ public abstract class Movement implements Helper, MovementHelper {
} }
public double calculateCostWithoutCaching() { public double calculateCostWithoutCaching() {
return calculateCost0(new CalculationContext()); return calculateCost(new CalculationContext());
} }
/** /**

View File

@ -186,6 +186,9 @@ public interface MovementHelper extends ActionCosts, Helper {
*/ */
static boolean canWalkOn(BlockPos pos, IBlockState state) { static boolean canWalkOn(BlockPos pos, IBlockState state) {
Block block = state.getBlock(); Block block = state.getBlock();
if (block == Blocks.AIR) {
return false;
}
if (block instanceof BlockLadder || (Baritone.settings().allowVines.get() && block instanceof BlockVine)) { // TODO reconsider this if (block instanceof BlockLadder || (Baritone.settings().allowVines.get() && block instanceof BlockVine)) { // TODO reconsider this
return true; return true;
} }
@ -198,8 +201,8 @@ public interface MovementHelper extends ActionCosts, Helper {
if (Blocks.ENDER_CHEST.equals(block) || Blocks.CHEST.equals(block)) { if (Blocks.ENDER_CHEST.equals(block) || Blocks.CHEST.equals(block)) {
return true; return true;
} }
if (block instanceof BlockAir) { if (block instanceof BlockSlab) {
return false; return true;
} }
if (BlockStateInterface.isWater(block)) { if (BlockStateInterface.isWater(block)) {
if (BlockStateInterface.isFlowing(state)) { if (BlockStateInterface.isFlowing(state)) {

View File

@ -28,6 +28,7 @@ import baritone.utils.InputOverrideHandler;
import baritone.utils.Utils; import baritone.utils.Utils;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockFalling; import net.minecraft.block.BlockFalling;
import net.minecraft.block.BlockSlab;
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.init.Blocks;
@ -53,7 +54,31 @@ public class MovementAscend extends Movement {
@Override @Override
protected double calculateCost(CalculationContext context) { protected double calculateCost(CalculationContext context) {
IBlockState srcDown = BlockStateInterface.get(src.down());
if (srcDown.getBlock() == Blocks.LADDER || srcDown.getBlock() == Blocks.VINE) {
return COST_INF;
}
// we can jump from soul sand, but not from a bottom slab
// the only thing we can ascend onto from a bottom slab is another bottom slab
boolean jumpingFromBottomSlab = false;
if (srcDown.getBlock() instanceof BlockSlab) {
BlockSlab jumpingFrom = (BlockSlab) srcDown.getBlock();
if (!jumpingFrom.isDouble()) {
jumpingFromBottomSlab = srcDown.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM;
}
}
IBlockState toPlace = BlockStateInterface.get(positionToPlace); IBlockState toPlace = BlockStateInterface.get(positionToPlace);
boolean jumpingToBottomSlab = false;
if (toPlace.getBlock() instanceof BlockSlab) {
BlockSlab jumpingTo = (BlockSlab) toPlace.getBlock();
if (!jumpingTo.isDouble() && toPlace.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM) {
jumpingToBottomSlab = true;
} else if (jumpingFromBottomSlab) {
return COST_INF;
}
} else if (jumpingFromBottomSlab) {
return COST_INF;
}
if (!MovementHelper.canWalkOn(positionToPlace, toPlace)) { if (!MovementHelper.canWalkOn(positionToPlace, toPlace)) {
if (!context.hasThrowaway()) { if (!context.hasThrowaway()) {
return COST_INF; return COST_INF;
@ -96,9 +121,11 @@ public class MovementAscend extends Movement {
// it's possible srcUp is AIR from the start, and srcUp2 is falling // it's possible srcUp is AIR from the start, and srcUp2 is falling
// and in that scenario, when we arrive and break srcUp2, that lets srcUp3 fall on us and suffocate us // and in that scenario, when we arrive and break srcUp2, that lets srcUp3 fall on us and suffocate us
} }
// TODO maybe change behavior if src.down() is soul sand?
double walk = WALK_ONE_BLOCK_COST; double walk = WALK_ONE_BLOCK_COST;
if (toPlace.getBlock().equals(Blocks.SOUL_SAND)) { if (jumpingToBottomSlab && !jumpingFromBottomSlab) {
return walk + getTotalHardnessOfBlocksToBreak(context); // we don't hit space we just walk into the slab
}
if (!jumpingToBottomSlab && toPlace.getBlock().equals(Blocks.SOUL_SAND)) {
walk *= WALK_ONE_OVER_SOUL_SAND_COST / WALK_ONE_BLOCK_COST; walk *= WALK_ONE_OVER_SOUL_SAND_COST / WALK_ONE_BLOCK_COST;
} }
// we hit space immediately on entering this action // we hit space immediately on entering this action
@ -123,7 +150,8 @@ public class MovementAscend extends Movement {
return state.setStatus(MovementStatus.SUCCESS); return state.setStatus(MovementStatus.SUCCESS);
} }
if (!MovementHelper.canWalkOn(positionToPlace)) { IBlockState jumpingOnto = BlockStateInterface.get(positionToPlace);
if (!MovementHelper.canWalkOn(positionToPlace, jumpingOnto)) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
BlockPos anAgainst = positionToPlace.offset(HORIZONTALS[i]); BlockPos anAgainst = positionToPlace.offset(HORIZONTALS[i]);
if (anAgainst.equals(src)) { if (anAgainst.equals(src)) {
@ -161,6 +189,9 @@ public class MovementAscend extends Movement {
return state.setStatus(MovementStatus.UNREACHABLE); return state.setStatus(MovementStatus.UNREACHABLE);
} }
MovementHelper.moveTowards(state, dest); MovementHelper.moveTowards(state, dest);
if (jumpingOnto.getBlock() instanceof BlockSlab && !((BlockSlab) jumpingOnto.getBlock()).isDouble() && jumpingOnto.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM && !(BlockStateInterface.get(src.down()).getBlock() instanceof BlockSlab)) {
return state; // don't jump while walking from a non slab into a bottom slab
}
if (headBonkClear()) { if (headBonkClear()) {
return state.setInput(InputOverrideHandler.Input.JUMP, true); return state.setInput(InputOverrideHandler.Input.JUMP, true);

View File

@ -25,8 +25,6 @@ import baritone.pathing.movement.MovementState.MovementStatus;
import baritone.utils.BlockStateInterface; import baritone.utils.BlockStateInterface;
import baritone.utils.InputOverrideHandler; import baritone.utils.InputOverrideHandler;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockLadder;
import net.minecraft.block.BlockVine;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -44,18 +42,22 @@ public class MovementDescend extends Movement {
@Override @Override
protected double calculateCost(CalculationContext context) { protected double calculateCost(CalculationContext context) {
Block fromDown = BlockStateInterface.get(src.down()).getBlock();
if (fromDown == Blocks.LADDER || fromDown == Blocks.VINE) {
return COST_INF;
}
if (!MovementHelper.canWalkOn(positionToPlace)) { if (!MovementHelper.canWalkOn(positionToPlace)) {
return COST_INF; return COST_INF;
} }
Block tmp1 = BlockStateInterface.get(dest).getBlock(); Block tmp1 = BlockStateInterface.get(dest).getBlock();
if (tmp1 instanceof BlockLadder || tmp1 instanceof BlockVine) { if (tmp1 == Blocks.LADDER || tmp1 == Blocks.VINE) {
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)
double walk = WALK_OFF_BLOCK_COST; double walk = WALK_OFF_BLOCK_COST;
if (BlockStateInterface.get(src.down()).getBlock().equals(Blocks.SOUL_SAND)) { if (fromDown == Blocks.SOUL_SAND) {
// use this ratio to apply the soul sand speed penalty to our 0.8 block distance // use this ratio to apply the soul sand speed penalty to our 0.8 block distance
walk *= WALK_ONE_OVER_SOUL_SAND_COST / WALK_ONE_BLOCK_COST; walk = WALK_ONE_OVER_SOUL_SAND_COST;
} }
return walk + Math.max(FALL_N_BLOCKS_COST[1], CENTER_AFTER_FALL_COST) + getTotalHardnessOfBlocksToBreak(context); return walk + Math.max(FALL_N_BLOCKS_COST[1], CENTER_AFTER_FALL_COST) + getTotalHardnessOfBlocksToBreak(context);
} }

View File

@ -75,6 +75,10 @@ public class MovementDiagonal extends Movement {
@Override @Override
protected double calculateCost(CalculationContext context) { protected double calculateCost(CalculationContext context) {
Block fromDown = BlockStateInterface.get(src.down()).getBlock();
if (fromDown == Blocks.LADDER || fromDown == Blocks.VINE) {
return COST_INF;
}
if (!MovementHelper.canWalkThrough(positionsToBreak[4]) || !MovementHelper.canWalkThrough(positionsToBreak[5])) { if (!MovementHelper.canWalkThrough(positionsToBreak[4]) || !MovementHelper.canWalkThrough(positionsToBreak[5])) {
return COST_INF; return COST_INF;
} }
@ -88,7 +92,7 @@ public class MovementDiagonal extends Movement {
if (destWalkOn.getBlock().equals(Blocks.SOUL_SAND)) { if (destWalkOn.getBlock().equals(Blocks.SOUL_SAND)) {
multiplier += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2; multiplier += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
} }
if (BlockStateInterface.get(src.down()).getBlock().equals(Blocks.SOUL_SAND)) { if (fromDown == Blocks.SOUL_SAND) {
multiplier += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2; multiplier += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
} }
Block cuttingOver1 = BlockStateInterface.get(positionsToBreak[2].down()).getBlock(); Block cuttingOver1 = BlockStateInterface.get(positionsToBreak[2].down()).getBlock();

View File

@ -23,9 +23,8 @@ import baritone.pathing.movement.MovementHelper;
import baritone.pathing.movement.MovementState; import baritone.pathing.movement.MovementState;
import baritone.utils.BlockStateInterface; import baritone.utils.BlockStateInterface;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockLadder;
import net.minecraft.block.BlockVine;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
public class MovementDownward extends Movement { public class MovementDownward extends Movement {
@ -49,7 +48,7 @@ public class MovementDownward extends Movement {
} }
IBlockState d = BlockStateInterface.get(dest); IBlockState d = BlockStateInterface.get(dest);
Block td = d.getBlock(); Block td = d.getBlock();
boolean ladder = td instanceof BlockLadder || td instanceof BlockVine; boolean ladder = td == Blocks.LADDER || td == Blocks.VINE;
if (ladder) { if (ladder) {
return LADDER_DOWN_ONE_COST; return LADDER_DOWN_ONE_COST;
} else { } else {

View File

@ -25,7 +25,9 @@ import baritone.pathing.movement.MovementState;
import baritone.pathing.movement.MovementState.MovementStatus; import baritone.pathing.movement.MovementState.MovementStatus;
import baritone.pathing.movement.MovementState.MovementTarget; import baritone.pathing.movement.MovementState.MovementTarget;
import baritone.utils.*; import baritone.utils.*;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFalling; import net.minecraft.block.BlockFalling;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -43,6 +45,10 @@ public class MovementFall extends Movement {
@Override @Override
protected double calculateCost(CalculationContext context) { protected double calculateCost(CalculationContext context) {
Block fromDown = BlockStateInterface.get(src.down()).getBlock();
if (fromDown == Blocks.LADDER || fromDown == Blocks.VINE) {
return COST_INF;
}
if (!MovementHelper.canWalkOn(dest.down())) { if (!MovementHelper.canWalkOn(dest.down())) {
return COST_INF; return COST_INF;
} }

View File

@ -47,11 +47,16 @@ public class MovementPillar extends Movement {
protected double calculateCost(CalculationContext context) { protected double calculateCost(CalculationContext context) {
Block fromDown = BlockStateInterface.get(src).getBlock(); Block fromDown = BlockStateInterface.get(src).getBlock();
boolean ladder = fromDown instanceof BlockLadder || fromDown instanceof BlockVine; boolean ladder = fromDown instanceof BlockLadder || fromDown instanceof BlockVine;
Block fromDownDown = BlockStateInterface.get(src.down()).getBlock(); IBlockState fromDownDown = BlockStateInterface.get(src.down());
if (!ladder) { if (!ladder) {
if (fromDownDown instanceof BlockLadder || fromDownDown instanceof BlockVine) { if (fromDownDown.getBlock() instanceof BlockLadder || fromDownDown.getBlock() instanceof BlockVine) {
return COST_INF; return COST_INF;
} }
if (fromDownDown.getBlock() instanceof BlockSlab) {
if (!((BlockSlab) fromDownDown.getBlock()).isDouble() && fromDownDown.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM) {
return COST_INF; // can't pillar up from a bottom slab onto a non ladder
}
}
} }
if (!context.hasThrowaway() && !ladder) { if (!context.hasThrowaway() && !ladder) {
return COST_INF; return COST_INF;
@ -87,7 +92,7 @@ public class MovementPillar extends Movement {
//} //}
} }
} }
if (fromDown instanceof BlockLiquid || fromDownDown instanceof BlockLiquid) {//can't pillar on water or in water if (fromDown instanceof BlockLiquid || fromDownDown.getBlock() instanceof BlockLiquid) {//can't pillar on water or in water
return COST_INF; return COST_INF;
} }
if (ladder) { if (ladder) {
@ -142,9 +147,12 @@ public class MovementPillar extends Movement {
return state.setStatus(MovementState.MovementStatus.UNREACHABLE); return state.setStatus(MovementState.MovementStatus.UNREACHABLE);
} }
if (playerFeet().equals(against.up()) || playerFeet().equals(dest)) if (playerFeet().equals(against.up()) || playerFeet().equals(dest)) {
return state.setStatus(MovementState.MovementStatus.SUCCESS); return state.setStatus(MovementState.MovementStatus.SUCCESS);
}
if (fromDown.getBlock() instanceof BlockSlab && !((BlockSlab) fromDown.getBlock()).isDouble() && fromDown.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM) {
state.setInput(InputOverrideHandler.Input.JUMP, true);
}
/* /*
if (thePlayer.getPosition0().getX() != from.getX() || thePlayer.getPosition0().getZ() != from.getZ()) { if (thePlayer.getPosition0().getX() != from.getX() || thePlayer.getPosition0().getZ() != from.getZ()) {
Baritone.moveTowardsBlock(from); Baritone.moveTowardsBlock(from);

View File

@ -85,7 +85,7 @@ public class MovementTraverse extends Movement {
return WC + hardness1 + hardness2; return WC + hardness1 + hardness2;
} else {//this is a bridge, so we need to place a block } else {//this is a bridge, so we need to place a block
Block srcDown = BlockStateInterface.get(src.down()).getBlock(); Block srcDown = BlockStateInterface.get(src.down()).getBlock();
if (srcDown instanceof BlockLadder || srcDown instanceof BlockVine) { if (srcDown == Blocks.LADDER || srcDown == Blocks.VINE) {
return COST_INF; return COST_INF;
} }
if (destOn.getBlock().equals(Blocks.AIR) || MovementHelper.isReplacable(positionToPlace, destOn)) { if (destOn.getBlock().equals(Blocks.AIR) || MovementHelper.isReplacable(positionToPlace, destOn)) {
@ -107,8 +107,8 @@ public class MovementTraverse extends Movement {
return WC + context.placeBlockCost() + getTotalHardnessOfBlocksToBreak(context); return WC + context.placeBlockCost() + getTotalHardnessOfBlocksToBreak(context);
} }
} }
if (Blocks.SOUL_SAND.equals(srcDown)) { if (srcDown == Blocks.SOUL_SAND || (srcDown instanceof BlockSlab && !((BlockSlab) srcDown).isDouble())) {
return COST_INF; // can't sneak and backplace against soul sand =/ return COST_INF; // can't sneak and backplace against soul sand or half slabs =/
} }
WC = WC * SNEAK_ONE_BLOCK_COST / WALK_ONE_BLOCK_COST;//since we are placing, we are sneaking WC = WC * SNEAK_ONE_BLOCK_COST / WALK_ONE_BLOCK_COST;//since we are placing, we are sneaking
return WC + context.placeBlockCost() + getTotalHardnessOfBlocksToBreak(context); return WC + context.placeBlockCost() + getTotalHardnessOfBlocksToBreak(context);
@ -206,7 +206,8 @@ public class MovementTraverse extends Movement {
return state.setStatus(MovementState.MovementStatus.UNREACHABLE); return state.setStatus(MovementState.MovementStatus.UNREACHABLE);
} }
state.setInput(InputOverrideHandler.Input.SNEAK, true); state.setInput(InputOverrideHandler.Input.SNEAK, true);
if (BlockStateInterface.get(playerFeet().down()).getBlock().equals(Blocks.SOUL_SAND)) { // see issue #118 Block standingOn = BlockStateInterface.get(playerFeet().down()).getBlock();
if (standingOn.equals(Blocks.SOUL_SAND) || standingOn instanceof BlockSlab) { // see issue #118
double dist = Math.max(Math.abs(dest.getX() + 0.5 - player().posX), Math.abs(dest.getZ() + 0.5 - player().posZ)); double dist = Math.max(Math.abs(dest.getX() + 0.5 - player().posX), Math.abs(dest.getZ() + 0.5 - player().posZ));
if (dist < 0.85) { // 0.5 + 0.3 + epsilon if (dist < 0.85) { // 0.5 + 0.3 + epsilon
MovementHelper.moveTowards(state, dest); MovementHelper.moveTowards(state, dest);

View File

@ -18,6 +18,7 @@
package baritone.utils; package baritone.utils;
import baritone.Baritone; import baritone.Baritone;
import net.minecraft.block.BlockSlab;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.multiplayer.WorldClient;
@ -47,10 +48,11 @@ public interface Helper {
default BlockPos playerFeet() { default BlockPos playerFeet() {
// TODO find a better way to deal with soul sand!!!!! // TODO find a better way to deal with soul sand!!!!!
return new BlockPos(player().posX, player().posY + 0.1251, player().posZ); BlockPos feet = new BlockPos(player().posX, player().posY + 0.1251, player().posZ);
/*if (BlockStateInterface.get(feet).getBlock().equals(Blocks.SOUL_SAND) && player().posY > feet.getY() + 0.874999) { if (BlockStateInterface.get(feet).getBlock() instanceof BlockSlab) {
return feet.up(); return feet.up();
}*/ }
return feet;
} }
default Vec3d playerFeetAsVec() { default Vec3d playerFeetAsVec() {