First commit
This commit is contained in:
32
pathfinding/goals/GoalYLevel.java
Normal file
32
pathfinding/goals/GoalYLevel.java
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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 + "}";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user