From c79591325926633d84d55e0aacbd48ec79774df3 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 5 Dec 2018 10:21:56 -0800 Subject: [PATCH] fix splicing behavior around water --- .../java/baritone/pathing/path/PathExecutor.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index fa4c0e5f..749a23e3 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -35,6 +35,7 @@ import baritone.pathing.movement.MovementHelper; import baritone.pathing.movement.movements.*; import baritone.utils.BlockStateInterface; import baritone.utils.Helper; +import net.minecraft.block.BlockLiquid; import net.minecraft.init.Blocks; import net.minecraft.util.Tuple; import net.minecraft.util.math.BlockPos; @@ -351,14 +352,22 @@ public class PathExecutor implements IPathExecutor, Helper { * @return Whether or not it was possible to snap to the current player feet */ public boolean snipsnapifpossible() { - if (!ctx.player().onGround) { + if (!ctx.player().onGround && !(ctx.world().getBlockState(ctx.playerFeet()).getBlock() instanceof BlockLiquid)) { + // if we're falling in the air, and not in water, don't splice return false; + } else { + // we are either onGround or in liquid + if (ctx.player().motionY < 0) { + // if we are strictly moving downwards (not stationary) + // we could be falling through water, which could be unsafe to splice + return false; // so don't + } } int index = path.positions().indexOf(ctx.playerFeet()); if (index == -1) { return false; } - pathPosition = index; + pathPosition = index; // jump directly to current position clearKeys(); return true; }