sprinting

This commit is contained in:
Leijurv
2018-08-11 13:08:16 -07:00
parent 3dc544b120
commit b829a666d4
5 changed files with 15 additions and 8 deletions
@@ -18,11 +18,13 @@
package baritone.bot.pathing.movement; package baritone.bot.pathing.movement;
import baritone.bot.Baritone; import baritone.bot.Baritone;
import baritone.bot.InputOverrideHandler;
import baritone.bot.behavior.impl.LookBehavior; import baritone.bot.behavior.impl.LookBehavior;
import baritone.bot.behavior.impl.LookBehaviorUtils; import baritone.bot.behavior.impl.LookBehaviorUtils;
import baritone.bot.pathing.movement.MovementState.MovementStatus; import baritone.bot.pathing.movement.MovementState.MovementStatus;
import baritone.bot.utils.*; import baritone.bot.utils.BlockStateInterface;
import baritone.bot.utils.Helper;
import baritone.bot.utils.Rotation;
import baritone.bot.utils.ToolSet;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
@@ -85,6 +87,7 @@ public abstract class Movement implements Helper, MovementHelper {
* @return Status * @return Status
*/ */
public MovementStatus update() { public MovementStatus update() {
player().setSprinting(false);
MovementState latestState = updateState(currentState); MovementState latestState = updateState(currentState);
if (BlockStateInterface.isLiquid(playerFeet())) { if (BlockStateInterface.isLiquid(playerFeet())) {
latestState.setInput(Input.JUMP, true); latestState.setInput(Input.JUMP, true);
@@ -79,7 +79,6 @@ public class MovementAscend extends Movement {
@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());
// TODO incorporate some behavior from ActionClimb (specifically how it waited until it was at most 1.2 blocks away before starting to jump // TODO incorporate some behavior from ActionClimb (specifically how it waited until it was at most 1.2 blocks away before starting to jump
// for efficiency in ascending minimal height staircases, which is just repeated MovementAscend, so that it doesn't bonk its head on the ceiling repeatedly) // for efficiency in ascending minimal height staircases, which is just repeated MovementAscend, so that it doesn't bonk its head on the ceiling repeatedly)
switch (state.getStatus()) { switch (state.getStatus()) {
@@ -58,6 +58,9 @@ public class MovementDiagonal extends Movement {
state.setStatus(MovementState.MovementStatus.SUCCESS); state.setStatus(MovementState.MovementStatus.SUCCESS);
return state; return state;
} }
if (!BlockStateInterface.isLiquid(playerFeet())) {
player().setSprinting(true);
}
MovementHelper.moveTowards(state, dest); MovementHelper.moveTowards(state, dest);
return state; return state;
} }
@@ -130,8 +130,8 @@ public class MovementTraverse extends Movement {
state.setStatus(MovementState.MovementStatus.SUCCESS); state.setStatus(MovementState.MovementStatus.SUCCESS);
return state; return state;
} }
if (wasTheBridgeBlockAlwaysThere) { if (wasTheBridgeBlockAlwaysThere && !BlockStateInterface.isLiquid(playerFeet())) {
// player().setSprinting(true); player().setSprinting(true);
} }
MovementHelper.moveTowards(state, positionsToBreak[0]); MovementHelper.moveTowards(state, positionsToBreak[0]);
return state; return state;
@@ -88,7 +88,9 @@ public class PathExecutor extends Behavior {
} }
for (int i = pathPosition + 2; i < path.length(); i++) { //dont check pathPosition+1. the movement tells us when it's done (e.g. sneak placing) for (int i = pathPosition + 2; i < path.length(); i++) { //dont check pathPosition+1. the movement tells us when it's done (e.g. sneak placing)
if (whereAmI.equals(path.positions().get(i))) { if (whereAmI.equals(path.positions().get(i))) {
if (i - pathPosition > 2) {
displayChatMessageRaw("Skipping forward " + (i - pathPosition) + " steps, to " + i); displayChatMessageRaw("Skipping forward " + (i - pathPosition) + " steps, to " + i);
}
pathPosition = i - 1; pathPosition = i - 1;
return; return;
} }