From ee8e44d3143e83720ee546e4438a17710c838e61 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 18 Aug 2018 12:21:21 -0700 Subject: [PATCH] don't start a path midair --- .../bot/behavior/impl/PathingBehavior.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java b/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java index 4bf49d97..b1f0be90 100644 --- a/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java +++ b/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java @@ -27,7 +27,9 @@ import baritone.bot.pathing.calc.IPathFinder; import baritone.bot.pathing.goals.Goal; import baritone.bot.pathing.path.IPath; import baritone.bot.pathing.path.PathExecutor; +import baritone.bot.utils.BlockStateInterface; import baritone.bot.utils.PathRenderer; +import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import java.awt.*; @@ -92,7 +94,7 @@ public class PathingBehavior extends Behavior { // if we aren't calculating right now return; } - findPathInNewThread(playerFeet(), true, Optional.empty()); + findPathInNewThread(pathStart(), true, Optional.empty()); } return; } @@ -168,11 +170,19 @@ public class PathingBehavior extends Behavior { if (isPathCalcInProgress) { return; } - findPathInNewThread(playerFeet(), true, Optional.empty()); + findPathInNewThread(pathStart(), true, Optional.empty()); } } } + public BlockPos pathStart() { + BlockPos feet = playerFeet(); + if (BlockStateInterface.get(feet.down()).getBlock().equals(Blocks.AIR)) { + return feet.down(); + } + return feet; + } + /** * In a new thread, pathfind to target blockpos *