sprint on soul sand, fixes #120
This commit is contained in:
@@ -117,19 +117,22 @@ public class MovementDiagonal extends Movement {
|
||||
return COST_INF;
|
||||
}
|
||||
}
|
||||
boolean water = false;
|
||||
if (BlockStateInterface.isWater(BlockStateInterface.getBlock(x, y, z)) || BlockStateInterface.isWater(destInto.getBlock())) {
|
||||
// Ignore previous multiplier
|
||||
// Whatever we were walking on (possibly soul sand) doesn't matter as we're actually floating on water
|
||||
// Not even touching the blocks below
|
||||
multiplier = WALK_ONE_IN_WATER_COST;
|
||||
water = true;
|
||||
}
|
||||
if (optionA != 0 || optionB != 0) {
|
||||
multiplier *= SQRT_2 - 0.001; // TODO tune
|
||||
}
|
||||
if (multiplier == WALK_ONE_BLOCK_COST && context.canSprint()) {
|
||||
// If we aren't edging around anything, and we aren't in water or soul sand
|
||||
if (context.canSprint() && !water) {
|
||||
// If we aren't edging around anything, and we aren't in water
|
||||
// We can sprint =D
|
||||
multiplier = SPRINT_ONE_BLOCK_COST;
|
||||
// Don't check for soul sand, since we can sprint on that too
|
||||
multiplier *= SPRINT_MULTIPLIER;
|
||||
}
|
||||
return multiplier * SQRT_2;
|
||||
}
|
||||
|
||||
@@ -67,8 +67,10 @@ public class MovementTraverse extends Movement {
|
||||
Block srcDown = BlockStateInterface.getBlock(x, y - 1, z);
|
||||
if (MovementHelper.canWalkOn(destX, y - 1, destZ, destOn)) {//this is a walk, not a bridge
|
||||
double WC = WALK_ONE_BLOCK_COST;
|
||||
boolean water = false;
|
||||
if (BlockStateInterface.isWater(pb0.getBlock()) || BlockStateInterface.isWater(pb1.getBlock())) {
|
||||
WC = WALK_ONE_IN_WATER_COST;
|
||||
water = true;
|
||||
} else {
|
||||
if (destOn.getBlock() == Blocks.SOUL_SAND) {
|
||||
WC += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
|
||||
@@ -83,10 +85,11 @@ public class MovementTraverse extends Movement {
|
||||
}
|
||||
double hardness2 = MovementHelper.getMiningDurationTicks(context, destX, y, destZ, pb1, false);
|
||||
if (hardness1 == 0 && hardness2 == 0) {
|
||||
if (WC == WALK_ONE_BLOCK_COST && context.canSprint()) {
|
||||
// If there's nothing in the way, and this isn't water or soul sand, and we aren't sneak placing
|
||||
if (!water && context.canSprint()) {
|
||||
// If there's nothing in the way, and this isn't water, and we aren't sneak placing
|
||||
// We can sprint =D
|
||||
WC = SPRINT_ONE_BLOCK_COST;
|
||||
// Don't check for soul sand, since we can sprint on that too
|
||||
WC *= SPRINT_MULTIPLIER;
|
||||
}
|
||||
return WC;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user