Refactoring
This commit is contained in:
@@ -7,13 +7,13 @@ package baritone.bot.event.events.type;
|
||||
public enum EventState {
|
||||
|
||||
/**
|
||||
* Indicates that whatever action the event is being
|
||||
* Indicates that whatever movement the event is being
|
||||
* dispatched as a result of is about to occur.
|
||||
*/
|
||||
PRE,
|
||||
|
||||
/**
|
||||
* Indicates that whatever action the event is being
|
||||
* Indicates that whatever movement the event is being
|
||||
* dispatched as a result of has already occured.
|
||||
*/
|
||||
POST
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package baritone.bot.pathing.calc;
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
=======
|
||||
import baritone.bot.pathing.movement.Movement;
|
||||
>>>>>>> Stashed changes
|
||||
import baritone.bot.pathing.goals.Goal;
|
||||
import baritone.bot.pathing.movement.Movement;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
@@ -45,7 +45,7 @@ public abstract class Movement implements AbstractGameEventListener, Helper, Mov
|
||||
|
||||
@Override
|
||||
public void onTick() {
|
||||
MovementState latestState = calcState();
|
||||
MovementState latestState = updateState();
|
||||
Optional<Vec3d> orientation = latestState.getGoal().rotation;
|
||||
if (orientation.isPresent()) {
|
||||
Tuple<Float, Float> rotation = Utils.calcRotationFromVec3d(mc.player.getPositionEyes(1.0F),
|
||||
@@ -60,6 +60,7 @@ public abstract class Movement implements AbstractGameEventListener, Helper, Mov
|
||||
currentState = latestState;
|
||||
|
||||
if (isFinished())
|
||||
onFinish();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -76,11 +77,16 @@ public abstract class Movement implements AbstractGameEventListener, Helper, Mov
|
||||
return dest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run cleanup on state finish
|
||||
*/
|
||||
public abstract void onFinish();
|
||||
|
||||
/**
|
||||
* Calculate latest movement state.
|
||||
* Gets called once a tick.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract MovementState calcState();
|
||||
public abstract MovementState updateState();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class MovementAscend extends Movement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovementState calcState() {
|
||||
public MovementState updateState() {
|
||||
MovementState latestState = currentState.setInput(InputOverrideHandler.Input.JUMP, true).setInput(InputOverrideHandler.Input.MOVE_FORWARD, true);
|
||||
if (playerFeet().equals(dest))
|
||||
latestState.setStatus(MovementState.MovementStatus.SUCCESS);
|
||||
|
||||
Reference in New Issue
Block a user