target rotation for traverse and ascend

This commit is contained in:
Leijurv 2018-08-05 21:25:06 -04:00
parent 785e5377e6
commit 5b96e6cd57
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 9 additions and 10 deletions

View File

@ -7,9 +7,12 @@ import baritone.bot.pathing.movement.MovementState;
import baritone.bot.pathing.movement.MovementState.MovementStatus; import baritone.bot.pathing.movement.MovementState.MovementStatus;
import baritone.bot.utils.BlockStateInterface; import baritone.bot.utils.BlockStateInterface;
import baritone.bot.utils.ToolSet; import baritone.bot.utils.ToolSet;
import baritone.bot.utils.Utils;
import net.minecraft.block.BlockFalling; import net.minecraft.block.BlockFalling;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import java.util.Optional;
public class MovementAscend extends Movement { public class MovementAscend extends Movement {
BlockPos[] against = new BlockPos[3]; BlockPos[] against = new BlockPos[3];
@ -58,14 +61,11 @@ public class MovementAscend extends Movement {
return WALK_ONE_BLOCK_COST / 2 + Math.max(JUMP_ONE_BLOCK_COST, WALK_ONE_BLOCK_COST / 2) + getTotalHardnessOfBlocksToBreak(ts);//we walk half the block to get to the edge, then we walk the other half while simultaneously jumping (math.max because of how it's in parallel) return WALK_ONE_BLOCK_COST / 2 + Math.max(JUMP_ONE_BLOCK_COST, WALK_ONE_BLOCK_COST / 2) + getTotalHardnessOfBlocksToBreak(ts);//we walk half the block to get to the edge, then we walk the other half while simultaneously jumping (math.max because of how it's in parallel)
} }
@Override
public void onFinish() {
}
@Override @Override
public MovementState updateState(MovementState state) { public MovementState updateState(MovementState state) {
super.updateState(state); super.updateState(state);
System.out.println("Ticking with state " + state.getStatus());
switch (state.getStatus()) { switch (state.getStatus()) {
case PREPPING: case PREPPING:
case UNREACHABLE: case UNREACHABLE:
@ -73,6 +73,8 @@ public class MovementAscend extends Movement {
return state; return state;
case WAITING: case WAITING:
case RUNNING: case RUNNING:
state.setTarget(new MovementState.MovementTarget(Optional.empty(), Optional.of(Utils.calcRotationFromCoords(playerFeet(), positionsToBreak[0]))));
MovementState latestState = state.setInput(InputOverrideHandler.Input.JUMP, true).setInput(InputOverrideHandler.Input.MOVE_FORWARD, true); MovementState latestState = state.setInput(InputOverrideHandler.Input.JUMP, true).setInput(InputOverrideHandler.Input.MOVE_FORWARD, true);
if (playerFeet().equals(dest)) if (playerFeet().equals(dest))
latestState.setStatus(MovementStatus.SUCCESS); latestState.setStatus(MovementStatus.SUCCESS);

View File

@ -81,14 +81,11 @@ public class MovementTraverse extends Movement {
} }
} }
@Override
public void onFinish() {
}
@Override @Override
public MovementState updateState(MovementState state) { public MovementState updateState(MovementState state) {
super.updateState(state); super.updateState(state);
System.out.println("Ticking with state " + state.getStatus());
System.out.println(state.getTarget().rotation);
switch (state.getStatus()) { switch (state.getStatus()) {
case PREPPING: case PREPPING:
case UNREACHABLE: case UNREACHABLE: