sprinting

This commit is contained in:
Leijurv 2018-08-11 13:08:16 -07:00
parent 3dc544b120
commit b829a666d4
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
5 changed files with 15 additions and 8 deletions

View File

@ -18,11 +18,13 @@
package baritone.bot.pathing.movement;
import baritone.bot.Baritone;
import baritone.bot.InputOverrideHandler;
import baritone.bot.behavior.impl.LookBehavior;
import baritone.bot.behavior.impl.LookBehaviorUtils;
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.Vec3d;
@ -85,6 +87,7 @@ public abstract class Movement implements Helper, MovementHelper {
* @return Status
*/
public MovementStatus update() {
player().setSprinting(false);
MovementState latestState = updateState(currentState);
if (BlockStateInterface.isLiquid(playerFeet())) {
latestState.setInput(Input.JUMP, true);

View File

@ -32,7 +32,7 @@ public class MovementAscend extends Movement {
private BlockPos[] against = new BlockPos[3];
public MovementAscend(BlockPos src, BlockPos dest) {
super(src, dest, new BlockPos[] { dest, src.up(2), dest.up() }, new BlockPos[] { dest.down() });
super(src, dest, new BlockPos[]{dest, src.up(2), dest.up()}, new BlockPos[]{dest.down()});
BlockPos placementLocation = positionsToPlace[0]; // dest.down()
int i = 0;
@ -79,7 +79,6 @@ public class MovementAscend extends Movement {
@Override
public MovementState updateState(MovementState 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
// 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()) {

View File

@ -37,7 +37,7 @@ public class MovementDiagonal extends Movement {
}
public MovementDiagonal(BlockPos start, BlockPos end, BlockPos dir1, BlockPos dir2) {
super(start, end, new BlockPos[] { dir1, dir1.up(), dir2, dir2.up(), end, end.up() }, new BlockPos[] { end.down() });
super(start, end, new BlockPos[]{dir1, dir1.up(), dir2, dir2.up(), end, end.up()}, new BlockPos[]{end.down()});
}
@Override
@ -58,6 +58,9 @@ public class MovementDiagonal extends Movement {
state.setStatus(MovementState.MovementStatus.SUCCESS);
return state;
}
if (!BlockStateInterface.isLiquid(playerFeet())) {
player().setSprinting(true);
}
MovementHelper.moveTowards(state, dest);
return state;
}

View File

@ -130,8 +130,8 @@ public class MovementTraverse extends Movement {
state.setStatus(MovementState.MovementStatus.SUCCESS);
return state;
}
if (wasTheBridgeBlockAlwaysThere) {
// player().setSprinting(true);
if (wasTheBridgeBlockAlwaysThere && !BlockStateInterface.isLiquid(playerFeet())) {
player().setSprinting(true);
}
MovementHelper.moveTowards(state, positionsToBreak[0]);
return state;

View File

@ -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)
if (whereAmI.equals(path.positions().get(i))) {
displayChatMessageRaw("Skipping forward " + (i - pathPosition) + " steps, to " + i);
if (i - pathPosition > 2) {
displayChatMessageRaw("Skipping forward " + (i - pathPosition) + " steps, to " + i);
}
pathPosition = i - 1;
return;
}