Module net.minestom.server
Interface NodeGenerator
- All Known Implementing Classes:
FlyingNodeGenerator
,GroundNodeGenerator
,PreciseGroundNodeGenerator
,WaterNodeGenerator
public interface NodeGenerator
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
canMoveTowards
(Block.Getter getter, Point start, Point end, BoundingBox boundingBox) Check if we can move directly from one point to anotherCollection
<? extends PNode> getWalkable
(Block.Getter getter, Set<PNode> visited, PNode current, Point goal, BoundingBox boundingBox) Gets the walkable nodes.gravitySnap
(Block.Getter getter, double pointX, double pointY, double pointZ, BoundingBox boundingBox, double maxFall) Snap point to the groundboolean
default double
Heuristic use for the distance from the node to the targetdefault boolean
pointInvalid
(Block.Getter getter, Point point, BoundingBox boundingBox) Check if the point is invalid
-
Method Details
-
getWalkable
Collection<? extends PNode> getWalkable(Block.Getter getter, Set<PNode> visited, PNode current, Point goal, BoundingBox boundingBox) Gets the walkable nodes.- Parameters:
getter
- the instancevisited
- the visited nodescurrent
- the current nodegoal
- the goalboundingBox
- the bounding box- Returns:
- the walkable nodes
-
hasGravitySnap
boolean hasGravitySnap()- Returns:
- snap start and end points to the ground
-
gravitySnap
OptionalDouble gravitySnap(Block.Getter getter, double pointX, double pointY, double pointZ, BoundingBox boundingBox, double maxFall) Snap point to the ground- Parameters:
getter
- the block getterpointX
- the x coordinatepointY
- the y coordinatepointZ
- the z coordinateboundingBox
- the bounding boxmaxFall
- the maximum fall distance- Returns:
- the snapped y coordinate. Empty if the snap point is not found
-
canMoveTowards
default boolean canMoveTowards(Block.Getter getter, Point start, Point end, BoundingBox boundingBox) Check if we can move directly from one point to another- Parameters:
getter
-start
-end
-boundingBox
-- Returns:
- true if we can move directly from start to end
-
pointInvalid
Check if the point is invalid- Parameters:
getter
-point
-boundingBox
-- Returns:
- true if the point is invalid
-
heuristic
Heuristic use for the distance from the node to the target- Parameters:
node
-target
-- Returns:
- the heuristic
-