Class PreciseGroundNodeGenerator
java.lang.Object
net.minestom.server.entity.pathfinding.generators.PreciseGroundNodeGenerator
- All Implemented Interfaces:
NodeGenerator
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canMoveTowards
(@NotNull Block.Getter getter, @NotNull Point startOrg, @NotNull Point endOrg, @NotNull BoundingBox boundingBox) Check if we can move directly from one point to another@NotNull Collection
<? extends PNode> getWalkable
(@NotNull Block.Getter getter, @NotNull Set<PNode> visited, @NotNull PNode current, @NotNull Point goal, @NotNull BoundingBox boundingBox) Gets the walkable nodes.@NotNull OptionalDouble
gravitySnap
(@NotNull Block.Getter getter, double pointOrgX, double pointOrgY, double pointOrgZ, @NotNull BoundingBox boundingBox, double maxFall) Snap point to the groundboolean
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minestom.server.entity.pathfinding.generators.NodeGenerator
heuristic, pointInvalid
-
Constructor Details
-
PreciseGroundNodeGenerator
public PreciseGroundNodeGenerator()
-
-
Method Details
-
getWalkable
@NotNull public @NotNull Collection<? extends PNode> getWalkable(@NotNull Block.Getter getter, @NotNull @NotNull Set<PNode> visited, @NotNull @NotNull PNode current, @NotNull @NotNull Point goal, @NotNull @NotNull BoundingBox boundingBox) Description copied from interface:NodeGenerator
Gets the walkable nodes.- Specified by:
getWalkable
in interfaceNodeGenerator
- Parameters:
getter
- the instancevisited
- the visited nodescurrent
- the current nodegoal
- the goalboundingBox
- the bounding box- Returns:
- the walkable nodes
-
hasGravitySnap
public boolean hasGravitySnap()- Specified by:
hasGravitySnap
in interfaceNodeGenerator
- Returns:
- snap start and end points to the ground
-
gravitySnap
@NotNull public @NotNull OptionalDouble gravitySnap(@NotNull Block.Getter getter, double pointOrgX, double pointOrgY, double pointOrgZ, @NotNull @NotNull BoundingBox boundingBox, double maxFall) Description copied from interface:NodeGenerator
Snap point to the ground- Specified by:
gravitySnap
in interfaceNodeGenerator
- Parameters:
getter
- the block getterpointOrgX
- the x coordinatepointOrgY
- the y coordinatepointOrgZ
- the z coordinateboundingBox
- the bounding boxmaxFall
- the maximum fall distance- Returns:
- the snapped y coordinate. Empty if the snap point is not found
-
canMoveTowards
public boolean canMoveTowards(@NotNull Block.Getter getter, @NotNull @NotNull Point startOrg, @NotNull @NotNull Point endOrg, @NotNull @NotNull BoundingBox boundingBox) Description copied from interface:NodeGenerator
Check if we can move directly from one point to another- Specified by:
canMoveTowards
in interfaceNodeGenerator
- Parameters:
getter
-startOrg
-endOrg
-boundingBox
-- Returns:
- true if we can move directly from start to end
-