MovementDescend update properly sets status

This commit is contained in:
Howard Stark 2018-08-06 16:07:24 -07:00
parent 5e665554ea
commit 6ecc928039
No known key found for this signature in database
GPG Key ID: 9FA4E350B33067F3

View File

@ -4,6 +4,7 @@ import baritone.bot.InputOverrideHandler;
import baritone.bot.pathing.movement.Movement; import baritone.bot.pathing.movement.Movement;
import baritone.bot.pathing.movement.MovementHelper; import baritone.bot.pathing.movement.MovementHelper;
import baritone.bot.pathing.movement.MovementState; import baritone.bot.pathing.movement.MovementState;
import baritone.bot.pathing.movement.MovementState.MovementStatus;
import baritone.bot.utils.BlockStateInterface; import baritone.bot.utils.BlockStateInterface;
import baritone.bot.utils.Rotation; import baritone.bot.utils.Rotation;
import baritone.bot.utils.ToolSet; import baritone.bot.utils.ToolSet;
@ -40,12 +41,13 @@ public class MovementDescend extends Movement {
case FAILED: case FAILED:
return state; return state;
case WAITING: case WAITING:
state.setStatus(MovementStatus.RUNNING);
case RUNNING: case RUNNING:
BlockPos playerFeet = playerFeet(); BlockPos playerFeet = playerFeet();
if (playerFeet.equals(dest) && player().posY - playerFeet.getY() < 0.01) { if (playerFeet.equals(dest) && player().posY - playerFeet.getY() < 0.01) {
// Wait until we're actually on the ground before saying we're done because sometimes we continue to fall if the next action starts immediately // Wait until we're actually on the ground before saying we're done because sometimes we continue to fall if the next action starts immediately
state.setStatus(MovementState.MovementStatus.SUCCESS); state.setStatus(MovementStatus.SUCCESS);
return state; return state;
} }
Rotation rotationToBlock = Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(positionsToBreak[1], world())); Rotation rotationToBlock = Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(positionsToBreak[1], world()));