fix splicing behavior around water
This commit is contained in:
parent
64eabf71f2
commit
c795913259
@ -35,6 +35,7 @@ import baritone.pathing.movement.MovementHelper;
|
|||||||
import baritone.pathing.movement.movements.*;
|
import baritone.pathing.movement.movements.*;
|
||||||
import baritone.utils.BlockStateInterface;
|
import baritone.utils.BlockStateInterface;
|
||||||
import baritone.utils.Helper;
|
import baritone.utils.Helper;
|
||||||
|
import net.minecraft.block.BlockLiquid;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.util.Tuple;
|
import net.minecraft.util.Tuple;
|
||||||
import net.minecraft.util.math.BlockPos;
|
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
|
* @return Whether or not it was possible to snap to the current player feet
|
||||||
*/
|
*/
|
||||||
public boolean snipsnapifpossible() {
|
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;
|
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());
|
int index = path.positions().indexOf(ctx.playerFeet());
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
pathPosition = index;
|
pathPosition = index; // jump directly to current position
|
||||||
clearKeys();
|
clearKeys();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user