can still fall into water if assumeWalkOnWater is true

This commit is contained in:
Leijurv 2018-09-15 07:51:46 -07:00
parent 9b375e1f5f
commit 19b47d77e5
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -60,7 +60,8 @@ public class MovementFall extends Movement {
return COST_INF; // falling onto a half slab is really glitchy, and can cause more fall damage than we'd expect
}
double placeBucketCost = 0.0;
if (!BlockStateInterface.isWater(dest) && src.getY() - dest.getY() > context.maxFallHeightNoWater()) {
boolean destIsWater = BlockStateInterface.isWater(dest);
if (!destIsWater && src.getY() - dest.getY() > context.maxFallHeightNoWater()) {
if (!context.hasWaterBucket()) {
return COST_INF;
}
@ -88,9 +89,16 @@ public class MovementFall extends Movement {
// And falling through signs is possible, but they do have a mining duration, right?
if (MovementHelper.getMiningDurationTicks(context, positionsToBreak[i], false) > 0) {
//can't break while falling
if (i != positionsToBreak.length - 1 || !destIsWater) {
// if we're checking the very last block to mine
// and it's water (so this is a water fall)
// don't consider the cost of "mining" it
// (if assumeWalkOnWater is true, water isn't canWalkThrough)
return COST_INF;
}
}
}
return WALK_OFF_BLOCK_COST + FALL_N_BLOCKS_COST[positionsToBreak.length - 1] + placeBucketCost + frontThree;
}