Package net.glowstone.util.pathfinding
Interface IAlgorithm
- All Known Implementing Classes:
AStarAlgorithm
public interface IAlgorithm
The base interface for all Pathfinding algorithms to implement from.
-
Method Summary
Modifier and TypeMethodDescriptionList<org.bukkit.util.Vector>calculatePath(GlowBlock startPoint, GlowBlock endPoint, Map<org.bukkit.Material, Double> materialWeights, org.bukkit.Material... blockedMaterials) Thanks to www.redblobgames.com/pathfinding/a-star/implementation.htmldefault Set<org.bukkit.util.Vector>getCornerNeighbors(org.bukkit.util.Vector vector) Used to get the locations that neighbor a vector's corners.default Set<org.bukkit.util.Vector>getFaceNeighbors(org.bukkit.util.Vector vector) Used to get the locations that neighbor a vector's faces.getNeighbors(org.bukkit.Location location, Map<org.bukkit.Material, Double> materialWeights, Set<org.bukkit.Material> blockedMaterials) Used to get the locations, as vectors, of neighboring blocks.
-
Method Details
-
calculatePath
List<org.bukkit.util.Vector> calculatePath(GlowBlock startPoint, GlowBlock endPoint, Map<org.bukkit.Material, Double> materialWeights, org.bukkit.Material... blockedMaterials) Thanks to www.redblobgames.com/pathfinding/a-star/implementation.html- Parameters:
startPoint- The starting position.endPoint- The ending position.materialWeights- A map containing amaterialkey, with acostas the value.blockedMaterials- A varargs ofmaterialsthat should be blocked from pathing.- Returns:
- A list of
Vectorsthat make up the path found during calculation.
-
getNeighbors
default Map<org.bukkit.util.Vector,Double> getNeighbors(org.bukkit.Location location, Map<org.bukkit.Material, Double> materialWeights, Set<org.bukkit.Material> blockedMaterials) Used to get the locations, as vectors, of neighboring blocks.- Parameters:
location- The location used in the calculation of neighbors.materialWeights- A map containing amaterialkey, with acostas the value.blockedMaterials- A set of materials that should be ignored.- Returns:
- A map of locations and their costs, after removing ignored materials, that neighbor the specified block.
-
getFaceNeighbors
Used to get the locations that neighbor a vector's faces.- Parameters:
vector- The vector we're grabbing the face neighbors of.- Returns:
- A set of vector's that neighbor the specified vector's faces.
-
getCornerNeighbors
Used to get the locations that neighbor a vector's corners.- Parameters:
vector- The vector we're grabbing the corner neighbors of.- Returns:
- A set of vector's that neighbor the specified vector's corners.
-