update logic

This commit is contained in:
Leijurv 2018-08-28 12:53:01 -07:00
parent d4d2fb392a
commit 1dc0f5c3ad
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 11 additions and 6 deletions

View File

@ -202,11 +202,13 @@ public interface MovementHelper extends ActionCosts, Helper {
if (BlockStateInterface.isFlowing(state)) { if (BlockStateInterface.isFlowing(state)) {
return false; return false;
} }
if (Baritone.settings().assumeWalkOnWater.get()) { Block up = BlockStateInterface.get(pos.up()).getBlock();
if (up instanceof BlockLilyPad) {
return true; return true;
} }
Block up = BlockStateInterface.get(pos.up()).getBlock(); // if assumeWalkOnWater is on, we can only walk on water if there isn't water above it
return BlockStateInterface.isWater(up) || up instanceof BlockLilyPad; // You can only walk on water if there is water above it // if assumeWalkOnWater is off, we can only walk on water if there is water above it
return BlockStateInterface.isWater(up) ^ Baritone.settings().assumeWalkOnWater.get();
} }
if (Blocks.MAGMA.equals(block)) { if (Blocks.MAGMA.equals(block)) {
return false; return false;

View File

@ -105,12 +105,15 @@ public class MovementTraverse extends Movement {
if (srcDown instanceof BlockLadder || srcDown instanceof BlockVine) { if (srcDown instanceof BlockLadder || srcDown instanceof BlockVine) {
return COST_INF; return COST_INF;
} }
IBlockState pp0 = BlockStateInterface.get(positionsToPlace[0]); if (destOn.getBlock().equals(Blocks.AIR) || MovementHelper.isReplacable(positionsToPlace[0], destOn)) {
if (pp0.getBlock().equals(Blocks.AIR) || (!BlockStateInterface.isWater(pp0.getBlock()) && MovementHelper.isReplacable(positionsToPlace[0], pp0))) { boolean throughWater = BlockStateInterface.isWater(pb0.getBlock()) || BlockStateInterface.isWater(pb1.getBlock());
if (BlockStateInterface.isWater(destOn.getBlock()) && throughWater) {
return COST_INF;
}
if (!context.hasThrowaway()) { if (!context.hasThrowaway()) {
return COST_INF; return COST_INF;
} }
double WC = BlockStateInterface.isWater(pb0.getBlock()) || BlockStateInterface.isWater(pb1.getBlock()) ? WALK_ONE_IN_WATER_COST : WALK_ONE_BLOCK_COST; double WC = throughWater ? WALK_ONE_IN_WATER_COST : WALK_ONE_BLOCK_COST;
for (BlockPos against1 : against) { for (BlockPos against1 : against) {
if (BlockStateInterface.get(against1).isBlockNormalCube()) { if (BlockStateInterface.get(against1).isBlockNormalCube()) {
return WC + context.placeBlockCost() + getTotalHardnessOfBlocksToBreak(context); return WC + context.placeBlockCost() + getTotalHardnessOfBlocksToBreak(context);