implement getSrc and getDest
This commit is contained in:
parent
e051ac12b5
commit
471c170884
@ -12,20 +12,17 @@ import net.minecraft.util.math.Vec3d;
|
|||||||
public abstract class Action implements AbstractGameEventListener, Helper, ActionWorldHelper {
|
public abstract class Action implements AbstractGameEventListener, Helper, ActionWorldHelper {
|
||||||
|
|
||||||
protected ActionState currentState;
|
protected ActionState currentState;
|
||||||
|
protected final BlockPos src;
|
||||||
|
protected final BlockPos dest;
|
||||||
|
|
||||||
public Action(BlockPos dest) {
|
protected Action(BlockPos src, BlockPos dest) {
|
||||||
this(Utils.calcCenterFromCoords(dest, mc.world));
|
this(src, dest, Utils.calcCenterFromCoords(dest, mc.world));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action(Vec3d dest) {
|
|
||||||
this(dest, dest);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action(BlockPos dest, Vec3d rotationTarget) {
|
protected Action(BlockPos src, BlockPos dest, Vec3d rotationTarget) {
|
||||||
this(Utils.calcCenterFromCoords(dest, mc.world), rotationTarget);
|
this.src = src;
|
||||||
}
|
this.dest = dest;
|
||||||
|
|
||||||
public Action(Vec3d dest, Vec3d rotationTarget) {
|
|
||||||
currentState = new ActionState()
|
currentState = new ActionState()
|
||||||
.setGoal(new ActionState.ActionGoal(dest, rotationTarget))
|
.setGoal(new ActionState.ActionGoal(dest, rotationTarget))
|
||||||
.setStatus(ActionStatus.WAITING);
|
.setStatus(ActionStatus.WAITING);
|
||||||
@ -63,11 +60,11 @@ public abstract class Action implements AbstractGameEventListener, Helper, Actio
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BlockPos getSrc() {
|
public BlockPos getSrc() {
|
||||||
return null; // TODO
|
return src;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockPos getDest() {
|
public BlockPos getDest() {
|
||||||
return null; // TODO
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package baritone.bot.pathing.action;
|
package baritone.bot.pathing.action;
|
||||||
|
|
||||||
import baritone.bot.InputOverrideHandler.Input;
|
import baritone.bot.InputOverrideHandler.Input;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -27,7 +28,7 @@ public class ActionState {
|
|||||||
* <p>
|
* <p>
|
||||||
* TODO: Decide desiredMovement type
|
* TODO: Decide desiredMovement type
|
||||||
*/
|
*/
|
||||||
public Vec3d position;
|
public BlockPos position;
|
||||||
/**
|
/**
|
||||||
* Yaw and pitch angles that must be matched
|
* Yaw and pitch angles that must be matched
|
||||||
* <p>
|
* <p>
|
||||||
@ -36,7 +37,7 @@ public class ActionState {
|
|||||||
*/
|
*/
|
||||||
public Vec3d rotation;
|
public Vec3d rotation;
|
||||||
|
|
||||||
public ActionGoal(Vec3d position, Vec3d rotation) {
|
public ActionGoal(BlockPos position, Vec3d rotation) {
|
||||||
this.position = position;
|
this.position = position;
|
||||||
this.rotation = rotation;
|
this.rotation = rotation;
|
||||||
}
|
}
|
||||||
|
@ -7,14 +7,14 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
|
|
||||||
public class ActionAscend extends Action {
|
public class ActionAscend extends Action {
|
||||||
|
|
||||||
public ActionAscend(BlockPos dest) {
|
public ActionAscend(BlockPos src, BlockPos dest) {
|
||||||
super(dest);
|
super(src, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionState calcState() {
|
public ActionState calcState() {
|
||||||
ActionState latestState = currentState.setInput(InputOverrideHandler.Input.JUMP,true).setInput(InputOverrideHandler.Input.MOVE_FORWARD, true);
|
ActionState latestState = currentState.setInput(InputOverrideHandler.Input.JUMP, true).setInput(InputOverrideHandler.Input.MOVE_FORWARD, true);
|
||||||
if(mc.player.getPosition().equals(latestState.getGoal().position))
|
if (mc.player.getPosition().equals(latestState.getGoal().position))
|
||||||
latestState.setStatus(ActionState.ActionStatus.SUCCESS);
|
latestState.setStatus(ActionState.ActionStatus.SUCCESS);
|
||||||
return latestState;
|
return latestState;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user