don't start a path midair

This commit is contained in:
Leijurv 2018-08-18 12:21:21 -07:00
parent d94e825a79
commit ee8e44d314
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
1 changed files with 12 additions and 2 deletions

View File

@ -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
*