soul sand fixes

This commit is contained in:
leijurv 2018-08-13 07:05:28 -07:00
parent 7c175bac67
commit 3a228803b6
3 changed files with 20 additions and 7 deletions

View File

@ -23,6 +23,8 @@ import baritone.bot.pathing.movement.MovementHelper;
import baritone.bot.pathing.movement.MovementState;
import baritone.bot.utils.BlockStateInterface;
import net.minecraft.block.BlockMagma;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
@ -76,9 +78,16 @@ public class MovementDiagonal extends Movement {
if (lastPos != 0) {
return COST_INF;
}
if (!MovementHelper.canWalkOn(positionsToPlace[0])) {
IBlockState destWalkOn = BlockStateInterface.get(positionsToPlace[0]);
if (!MovementHelper.canWalkOn(positionsToPlace[0], destWalkOn)) {
return COST_INF;
}
double multiplier = 1;
if (destWalkOn.getBlock().equals(Blocks.SOUL_SAND)) {
multiplier *= WALK_ONE_IN_WATER_COST / WALK_ONE_BLOCK_COST;
} else if (BlockStateInterface.get(src).getBlock().equals(Blocks.SOUL_SAND)) {
multiplier *= WALK_ONE_IN_WATER_COST / WALK_ONE_BLOCK_COST;
}
if (BlockStateInterface.get(positionsToBreak[2].down()).getBlock() instanceof BlockMagma) {
return COST_INF;
}
@ -106,9 +115,8 @@ public class MovementDiagonal extends Movement {
return COST_INF;
}
}
double multiplier = 1;
if (optionA != 0 || optionB != 0) {
multiplier = SQRT_2 - 0.001; // TODO tune
multiplier *= SQRT_2 - 0.001; // TODO tune
}
return multiplier * SQRT_2 * (BlockStateInterface.isWater(src) || BlockStateInterface.isWater(dest) ? WALK_ONE_IN_WATER_COST : WALK_ONE_BLOCK_COST);
}

View File

@ -69,7 +69,11 @@ public class MovementTraverse extends Movement {
IBlockState pb0 = BlockStateInterface.get(positionsToBreak[0]);
IBlockState pb1 = BlockStateInterface.get(positionsToBreak[1]);
double WC = BlockStateInterface.isWater(pb0.getBlock()) || BlockStateInterface.isWater(pb1.getBlock()) ? WALK_ONE_IN_WATER_COST : WALK_ONE_BLOCK_COST;
if (MovementHelper.canWalkOn(positionsToPlace[0])) {//this is a walk, not a bridge
IBlockState destOn = BlockStateInterface.get(positionsToPlace[0]);
if (MovementHelper.canWalkOn(positionsToPlace[0], destOn)) {//this is a walk, not a bridge
if (destOn.getBlock().equals(Blocks.SOUL_SAND)) {
WC *= SNEAK_ONE_BLOCK_COST / WALK_ONE_BLOCK_COST;
}
if (MovementHelper.canWalkThrough(positionsToBreak[0]) && MovementHelper.canWalkThrough(positionsToBreak[1])) {
return WC;
}

View File

@ -48,10 +48,11 @@ public interface Helper {
}
default BlockPos playerFeet() {
BlockPos feet = new BlockPos(player().posX, player().posY, player().posZ);
if (BlockStateInterface.get(feet).getBlock().equals(Blocks.SOUL_SAND) && player().posY > feet.getY() + 0.874999) {
// TODO find a better way to deal with soul sand!!!!!
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) {
return feet.up();
}
}*/
return feet;
}