Merge branch 'master' of github.com:cabaletta/baritone
This commit is contained in:
commit
46f76df2af
5
src/main/java/baritone/bot/pathing/actions/Action.java
Normal file
5
src/main/java/baritone/bot/pathing/actions/Action.java
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package baritone.bot.pathing.actions;
|
||||||
|
|
||||||
|
public interface Action {
|
||||||
|
double cost();
|
||||||
|
}
|
@ -12,19 +12,24 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
* @author leijurv
|
* @author leijurv
|
||||||
*/
|
*/
|
||||||
public class GoalYLevel implements Goal {
|
public class GoalYLevel implements Goal {
|
||||||
|
|
||||||
final int level;
|
final int level;
|
||||||
|
|
||||||
public GoalYLevel(int level) {
|
public GoalYLevel(int level) {
|
||||||
this.level = level;
|
this.level = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInGoal(BlockPos pos) {
|
public boolean isInGoal(BlockPos pos) {
|
||||||
return pos.getY() == level;
|
return pos.getY() == level;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double heuristic(BlockPos pos) {
|
public double heuristic(BlockPos pos) {
|
||||||
return 20 * Math.abs(pos.getY() - level);//the number 20 was chosen somewhat randomly.
|
return 20 * Math.abs(pos.getY() - level);//the number 20 was chosen somewhat randomly.
|
||||||
//TODO fix that
|
//TODO fix that
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Goal{y=" + level + "}";
|
return "Goal{y=" + level + "}";
|
||||||
|
25
src/main/java/baritone/bot/pathing/movements/Movement.java
Normal file
25
src/main/java/baritone/bot/pathing/movements/Movement.java
Normal 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();
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user