don't sprint straight into danger

This commit is contained in:
Leijurv 2018-11-20 18:58:41 -08:00
parent fb971301a4
commit 2a674cb869
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -226,7 +226,10 @@ public class MovementTraverse extends Movement {
if (ctx.playerFeet().equals(dest)) { if (ctx.playerFeet().equals(dest)) {
return state.setStatus(MovementStatus.SUCCESS); return state.setStatus(MovementStatus.SUCCESS);
} }
if (wasTheBridgeBlockAlwaysThere && !MovementHelper.isLiquid(ctx, ctx.playerFeet())) { BlockPos into = dest.subtract(src).add(dest);
Block intoBelow = BlockStateInterface.get(ctx, into).getBlock();
Block intoAbove = BlockStateInterface.get(ctx, into.up()).getBlock();
if (wasTheBridgeBlockAlwaysThere && !MovementHelper.isLiquid(ctx, ctx.playerFeet()) && !MovementHelper.avoidWalkingInto(intoBelow) && !MovementHelper.avoidWalkingInto(intoAbove)) {
state.setInput(Input.SPRINT, true); state.setInput(Input.SPRINT, true);
} }
Block destDown = BlockStateInterface.get(ctx, dest.down()).getBlock(); Block destDown = BlockStateInterface.get(ctx, dest.down()).getBlock();