fix overshoot

This commit is contained in:
Leijurv 2019-04-17 19:46:25 -07:00
parent c013d1e0d9
commit 0b72a8b4b3
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 9 additions and 7 deletions

View File

@ -25,7 +25,6 @@ import baritone.api.utils.*;
import baritone.api.utils.input.Input; import baritone.api.utils.input.Input;
import baritone.pathing.movement.MovementState.MovementTarget; import baritone.pathing.movement.MovementState.MovementTarget;
import baritone.utils.BlockStateInterface; import baritone.utils.BlockStateInterface;
import baritone.api.utils.Helper;
import baritone.utils.ToolSet; import baritone.utils.ToolSet;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyBool;
@ -312,6 +311,10 @@ public interface MovementHelper extends ActionCosts, Helper {
return canWalkOn(new BlockStateInterface(ctx), pos.x, pos.y, pos.z, state); return canWalkOn(new BlockStateInterface(ctx), pos.x, pos.y, pos.z, state);
} }
static boolean canWalkOn(IPlayerContext ctx, BlockPos pos) {
return canWalkOn(new BlockStateInterface(ctx), pos.getX(), pos.getY(), pos.getZ());
}
static boolean canWalkOn(IPlayerContext ctx, BetterBlockPos pos) { static boolean canWalkOn(IPlayerContext ctx, BetterBlockPos pos) {
return canWalkOn(new BlockStateInterface(ctx), pos.x, pos.y, pos.z); return canWalkOn(new BlockStateInterface(ctx), pos.x, pos.y, pos.z);
} }

View File

@ -23,10 +23,7 @@ import baritone.api.pathing.movement.ActionCosts;
import baritone.api.pathing.movement.IMovement; import baritone.api.pathing.movement.IMovement;
import baritone.api.pathing.movement.MovementStatus; import baritone.api.pathing.movement.MovementStatus;
import baritone.api.pathing.path.IPathExecutor; import baritone.api.pathing.path.IPathExecutor;
import baritone.api.utils.BetterBlockPos; import baritone.api.utils.*;
import baritone.api.utils.IPlayerContext;
import baritone.api.utils.RotationUtils;
import baritone.api.utils.VecUtils;
import baritone.api.utils.input.Input; import baritone.api.utils.input.Input;
import baritone.behavior.PathingBehavior; import baritone.behavior.PathingBehavior;
import baritone.pathing.calc.AbstractNodeCostSearch; import baritone.pathing.calc.AbstractNodeCostSearch;
@ -35,7 +32,6 @@ import baritone.pathing.movement.Movement;
import baritone.pathing.movement.MovementHelper; 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.api.utils.Helper;
import net.minecraft.block.BlockLiquid; 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;
@ -569,7 +565,10 @@ public class PathExecutor implements IPathExecutor, Helper {
if (next instanceof MovementDescend && next.getDirection().equals(current.getDirection())) { if (next instanceof MovementDescend && next.getDirection().equals(current.getDirection())) {
return true; return true;
} }
if (next instanceof MovementTraverse && next.getDirection().down().equals(current.getDirection()) && MovementHelper.canWalkOn(ctx, next.getDest().down())) { if (!MovementHelper.canWalkOn(ctx, current.getDest().add(current.getDirection()))) {
return false;
}
if (next instanceof MovementTraverse && next.getDirection().down().equals(current.getDirection())) {
return true; return true;
} }
return next instanceof MovementDiagonal && Baritone.settings().allowOvershootDiagonalDescend.value; return next instanceof MovementDiagonal && Baritone.settings().allowOvershootDiagonalDescend.value;