baritone/pathfinding/goals/GoalYLevel.java
2018-08-01 11:34:35 -04:00

33 lines
802 B
Java

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package baritone.pathfinding.goals;
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 + "}";
}
}