Files
baritone/src/main/java/baritone/pathing/calc/IPathFinder.java

68 lines
2.1 KiB
Java
Raw Normal View History

2018-08-07 22:16:53 -05:00
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
2018-08-07 22:16:53 -05:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
2018-08-22 13:15:56 -07:00
package baritone.pathing.calc;
2018-08-03 00:50:45 -04:00
2018-08-22 13:15:56 -07:00
import baritone.pathing.goals.Goal;
import baritone.pathing.path.IPath;
2018-08-03 00:50:45 -04:00
import net.minecraft.util.math.BlockPos;
import java.util.Optional;
2018-08-03 09:55:17 -04:00
/**
* Generic path finder interface
*
* @author leijurv
*/
2018-08-03 00:50:45 -04:00
public interface IPathFinder {
2018-08-03 00:50:45 -04:00
BlockPos getStart();
Goal getGoal();
/**
* Calculate the path in full. Will take several seconds.
*
* @return The final path
2018-08-03 00:50:45 -04:00
*/
Optional<IPath> calculate(long timeout);
2018-08-03 00:50:45 -04:00
/**
* Intended to be called concurrently with calculatePath from a different thread to tell if it's finished yet
*
* @return Whether or not this finder is finished
2018-08-03 00:50:45 -04:00
*/
boolean isFinished();
/**
* Called for path rendering. Returns a path to the most recent node popped from the open set and considered.
*
* @return The temporary path
2018-08-03 00:50:45 -04:00
*/
Optional<IPath> pathToMostRecentNodeConsidered();
2018-08-03 00:50:45 -04:00
/**
* The best path so far, according to the most forgiving coefficient heuristic (the reason being that that path is
* most likely to represent the true shape of the path to the goal, assuming it's within a possible cost heuristic.
* That's almost always a safe assumption, but in the case of a nearly impossible path, it still works by providing
* a theoretically plausible but practically unlikely path)
*
* @return The temporary path
2018-08-03 00:50:45 -04:00
*/
Optional<IPath> bestPathSoFar();
2018-08-03 00:50:45 -04:00
}