Interface IAlgorithm

All Known Implementing Classes:
AStarAlgorithm

public interface IAlgorithm
The base interface for all Pathfinding algorithms to implement from.
  • Method Summary

    Modifier and Type
    Method
    Description
    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
    default 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.
    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.
  • 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 a material key, with a cost as the value.
      blockedMaterials - A varargs of materials that should be blocked from pathing.
      Returns:
      A list of Vectors that 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 a material key, with a cost as 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

      default Set<org.bukkit.util.Vector> getFaceNeighbors(org.bukkit.util.Vector vector)
      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

      default Set<org.bukkit.util.Vector> getCornerNeighbors(org.bukkit.util.Vector vector)
      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.