Interface NodeGenerator
- All Known Implementing Classes:
FlyingNodeGenerator,GroundNodeGenerator,PreciseGroundNodeGenerator,WaterNodeGenerator
public interface NodeGenerator
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleancanMoveTowards(@NotNull Instance instance, @NotNull net.minestom.server.coordinate.Point start, @NotNull net.minestom.server.coordinate.Point end, @NotNull BoundingBox boundingBox) Check if we can move directly from one point to another@NotNull Collection<? extends PNode> getWalkable(@NotNull Instance instance, @NotNull Set<PNode> visited, @NotNull PNode current, @NotNull net.minestom.server.coordinate.Point goal, @NotNull BoundingBox boundingBox) Gets the walkable nodes.@NotNull OptionalDoublegravitySnap(@NotNull Instance instance, double pointX, double pointY, double pointZ, @NotNull BoundingBox boundingBox, double maxFall) Snap point to the groundbooleandefault doubleheuristic(@NotNull net.minestom.server.coordinate.Point node, @NotNull net.minestom.server.coordinate.Point target) Heuristic use for the distance from the node to the targetdefault booleanpointInvalid(@NotNull Instance instance, @NotNull net.minestom.server.coordinate.Point point, @NotNull BoundingBox boundingBox) Check if the point is invalid
-
Method Details
-
getWalkable
@NotNull @NotNull Collection<? extends PNode> getWalkable(@NotNull @NotNull Instance instance, @NotNull @NotNull Set<PNode> visited, @NotNull @NotNull PNode current, @NotNull @NotNull net.minestom.server.coordinate.Point goal, @NotNull @NotNull BoundingBox boundingBox) Gets the walkable nodes.- Parameters:
instance- 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
@NotNull @NotNull OptionalDouble gravitySnap(@NotNull @NotNull Instance instance, double pointX, double pointY, double pointZ, @NotNull @NotNull BoundingBox boundingBox, double maxFall) Snap point to the ground- Parameters:
instance- the instancepointX- 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(@NotNull @NotNull Instance instance, @NotNull @NotNull net.minestom.server.coordinate.Point start, @NotNull @NotNull net.minestom.server.coordinate.Point end, @NotNull @NotNull BoundingBox boundingBox) Check if we can move directly from one point to another- Parameters:
instance-start-end-boundingBox-- Returns:
- true if we can move directly from start to end
-
pointInvalid
default boolean pointInvalid(@NotNull @NotNull Instance instance, @NotNull @NotNull net.minestom.server.coordinate.Point point, @NotNull @NotNull BoundingBox boundingBox) Check if the point is invalid- Parameters:
instance-point-boundingBox-- Returns:
- true if the point is invalid
-
heuristic
default double heuristic(@NotNull @NotNull net.minestom.server.coordinate.Point node, @NotNull @NotNull net.minestom.server.coordinate.Point target) Heuristic use for the distance from the node to the target- Parameters:
node-target-- Returns:
- the heuristic
-