fix splicing behavior around water

This commit is contained in:
Leijurv 2018-12-05 10:21:56 -08:00
parent 64eabf71f2
commit c795913259
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -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;
}