Rename Movements
This commit is contained in:
parent
1397b137ae
commit
0fd11f80f5
@ -7,7 +7,7 @@ import baritone.bot.pathing.movement.ActionCosts;
|
||||
import baritone.bot.pathing.movement.Movement;
|
||||
import baritone.bot.pathing.movement.movements.MovementAscend;
|
||||
import baritone.bot.pathing.movement.movements.MovementDescend;
|
||||
import baritone.bot.pathing.movement.movements.MovementFall;
|
||||
import baritone.bot.pathing.movement.movements.MovementDownward;
|
||||
import baritone.bot.pathing.movement.movements.MovementTraverse;
|
||||
import baritone.bot.pathing.path.IPath;
|
||||
import baritone.bot.utils.ToolSet;
|
||||
@ -163,7 +163,7 @@ public class AStarPathFinder extends AbstractNodeCostSearch {
|
||||
movements[9] = new MovementDescend(pos, new BlockPos(x - 1, y - 1, z));
|
||||
movements[10] = new MovementDescend(pos, new BlockPos(x, y - 1, z + 1));
|
||||
movements[11] = new MovementDescend(pos, new BlockPos(x, y - 1, z - 1));
|
||||
movements[12] = new MovementFall(pos);
|
||||
movements[12] = new MovementDownward(pos);
|
||||
/*Action[] actions = new Action[26];
|
||||
actions[0] = new ActionPillar(pos);
|
||||
actions[1] = new ActionBridge(pos, new BlockPos(x + 1, y, z));
|
||||
|
@ -0,0 +1,61 @@
|
||||
package baritone.bot.pathing.movement.movements;
|
||||
|
||||
import baritone.bot.InputOverrideHandler;
|
||||
import baritone.bot.pathing.movement.Movement;
|
||||
import baritone.bot.pathing.movement.MovementHelper;
|
||||
import baritone.bot.pathing.movement.MovementState;
|
||||
import baritone.bot.utils.BlockStateInterface;
|
||||
import baritone.bot.utils.Rotation;
|
||||
import baritone.bot.utils.ToolSet;
|
||||
import baritone.bot.utils.Utils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLadder;
|
||||
import net.minecraft.block.BlockVine;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public class MovementDownward extends Movement {
|
||||
public MovementDownward(BlockPos start) {
|
||||
super(start, start.down(), new BlockPos[]{start.down()}, new BlockPos[0]);
|
||||
}
|
||||
|
||||
int numTicks = 0;
|
||||
|
||||
@Override
|
||||
public MovementState updateState(MovementState state) {
|
||||
super.updateState(state);
|
||||
System.out.println("Ticking with state " + state.getStatus());
|
||||
switch (state.getStatus()) {
|
||||
case PREPPING:
|
||||
case UNREACHABLE:
|
||||
case FAILED:
|
||||
return state;
|
||||
case WAITING:
|
||||
case RUNNING:
|
||||
if (playerFeet().equals(dest)) {
|
||||
state.setStatus(MovementState.MovementStatus.SUCCESS);
|
||||
return state;
|
||||
}
|
||||
if (numTicks++ < 10) {
|
||||
return state;
|
||||
}
|
||||
Rotation rotationToBlock = Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(positionsToBreak[0], world()));
|
||||
return state.setTarget(new MovementState.MovementTarget(rotationToBlock)).setInput(InputOverrideHandler.Input.MOVE_FORWARD, true);
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double calculateCost(ToolSet ts) {
|
||||
if (!MovementHelper.canWalkOn(dest.down(), BlockStateInterface.get(dest.down()))) {
|
||||
return COST_INF;
|
||||
}
|
||||
Block td = BlockStateInterface.get(dest).getBlock();
|
||||
boolean ladder = td instanceof BlockLadder || td instanceof BlockVine;
|
||||
if (ladder) {
|
||||
return LADDER_DOWN_ONE_COST;
|
||||
} else {
|
||||
return FALL_N_BLOCKS_COST[1] + getTotalHardnessOfBlocksToBreak(ts);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user