Begin movement/action rewrite

This commit is contained in:
Howard Stark 2018-08-02 00:07:55 -04:00
parent 937be3fce3
commit 2ee6802414
No known key found for this signature in database
GPG Key ID: 9FA4E350B33067F3
3 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,5 @@
package baritone.bot.pathing.actions;
public interface Action {
double cost();
}

View File

@ -12,19 +12,24 @@ import net.minecraft.util.math.BlockPos;
* @author leijurv
*/
public class GoalYLevel implements Goal {
final int level;
public GoalYLevel(int level) {
this.level = level;
}
@Override
public boolean isInGoal(BlockPos pos) {
return pos.getY() == level;
}
@Override
public double heuristic(BlockPos pos) {
return 20 * Math.abs(pos.getY() - level);//the number 20 was chosen somewhat randomly.
//TODO fix that
}
@Override
public String toString() {
return "Goal{y=" + level + "}";

View File

@ -0,0 +1,25 @@
package baritone.bot.pathing.movements;
import baritone.bot.pathing.actions.Action;
import net.minecraft.util.math.BlockPos;
import java.util.List;
public abstract class Movement {
protected List<Action> actions;
/**
* Gets source block position for Movement.
*
* @return Movement's starting block position
*/
public abstract BlockPos getSrc();
/**
* Gets the block position the movement should finish at
*
* @return Movement's final block position
*/
public abstract BlockPos getDest();
}