implement getSrc and getDest
This commit is contained in:
		| @@ -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; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -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; | ||||
|         } | ||||
|   | ||||
| @@ -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; | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user