implement getSrc and getDest

This commit is contained in:
Leijurv 2018-08-02 14:12:56 -04:00
parent e051ac12b5
commit 471c170884
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
3 changed files with 16 additions and 18 deletions

View File

@ -12,20 +12,17 @@ import net.minecraft.util.math.Vec3d;
public abstract class Action implements AbstractGameEventListener, Helper, ActionWorldHelper {
protected ActionState currentState;
protected final BlockPos src;
protected final BlockPos dest;
public Action(BlockPos dest) {
this(Utils.calcCenterFromCoords(dest, mc.world));
protected Action(BlockPos src, BlockPos dest) {
this(src, dest, Utils.calcCenterFromCoords(dest, mc.world));
}
public Action(Vec3d dest) {
this(dest, dest);
}
public Action(BlockPos dest, Vec3d rotationTarget) {
this(Utils.calcCenterFromCoords(dest, mc.world), rotationTarget);
}
public Action(Vec3d dest, Vec3d rotationTarget) {
protected Action(BlockPos src, BlockPos dest, Vec3d rotationTarget) {
this.src = src;
this.dest = dest;
currentState = new ActionState()
.setGoal(new ActionState.ActionGoal(dest, rotationTarget))
.setStatus(ActionStatus.WAITING);
@ -63,11 +60,11 @@ public abstract class Action implements AbstractGameEventListener, Helper, Actio
}
public BlockPos getSrc() {
return null; // TODO
return src;
}
public BlockPos getDest() {
return null; // TODO
return dest;
}
/**

View File

@ -1,6 +1,7 @@
package baritone.bot.pathing.action;
import baritone.bot.InputOverrideHandler.Input;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import java.util.HashMap;
@ -27,7 +28,7 @@ public class ActionState {
* <p>
* TODO: Decide desiredMovement type
*/
public Vec3d position;
public BlockPos position;
/**
* Yaw and pitch angles that must be matched
* <p>
@ -36,7 +37,7 @@ public class ActionState {
*/
public Vec3d rotation;
public ActionGoal(Vec3d position, Vec3d rotation) {
public ActionGoal(BlockPos position, Vec3d rotation) {
this.position = position;
this.rotation = rotation;
}

View File

@ -7,14 +7,14 @@ import net.minecraft.util.math.BlockPos;
public class ActionAscend extends Action {
public ActionAscend(BlockPos dest) {
super(dest);
public ActionAscend(BlockPos src, BlockPos dest) {
super(src, dest);
}
@Override
public ActionState calcState() {
ActionState latestState = currentState.setInput(InputOverrideHandler.Input.JUMP,true).setInput(InputOverrideHandler.Input.MOVE_FORWARD, true);
if(mc.player.getPosition().equals(latestState.getGoal().position))
ActionState latestState = currentState.setInput(InputOverrideHandler.Input.JUMP, true).setInput(InputOverrideHandler.Input.MOVE_FORWARD, true);
if (mc.player.getPosition().equals(latestState.getGoal().position))
latestState.setStatus(ActionState.ActionStatus.SUCCESS);
return latestState;
}