Package com.destroystokyo.paper.entity

# Interface Pathfinder

public interface Pathfinder
Handles pathfinding operations for an Entity

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static interface`
`Pathfinder.PathResult`
Represents the result of a pathfinding calculation

## Method Summary

Modifier and Type
Method
Description
`boolean`
`canFloat()`
Checks if this pathfinder assumes that the mob can float
`boolean`
`canOpenDoors()`
Checks if this pathfinder allows passing through closed doors.
`boolean`
`canPassDoors()`
Checks if this pathfinder allows passing through open doors.
`@Nullable Pathfinder.PathResult`
`findPath(@NotNull LivingEntity target)`
Calculates a destination for the Entity to navigate to to reach the target entity, but does not set it as the current target.
`@Nullable Pathfinder.PathResult`
`findPath(@NotNull Location loc)`
Calculates a destination for the Entity to navigate to, but does not set it as the current target.
`@Nullable Pathfinder.PathResult`
`getCurrentPath()`
`@NotNull Mob`
`getEntity()`
`boolean`
`hasPath()`
If the entity is currently trying to navigate to a destination, this will return true
`default boolean`
`moveTo(@NotNull Pathfinder.PathResult path)`
Takes the result of a previous pathfinding calculation and sets it as the active pathfinding with default speed.
`boolean`
`moveTo(@NotNull Pathfinder.PathResult path, double speed)`
Takes the result of a previous pathfinding calculation and sets it as the active pathfinding,
`default boolean`
`moveTo(@NotNull LivingEntity target)`
Calculates a destination for the Entity to navigate to to reach the target entity, and sets it with default speed.
`default boolean`
`moveTo(@NotNull LivingEntity target, double speed)`
Calculates a destination for the Entity to navigate to to reach the target entity, and sets it with specified speed.
`default boolean`
`moveTo(@NotNull Location loc)`
Calculates a destination for the Entity to navigate to, and sets it with default speed as the current target.
`default boolean`
`moveTo(@NotNull Location loc, double speed)`
Calculates a destination for the Entity to navigate to, with desired speed as the current target.
`void`
`setCanFloat(boolean canFloat)`
Makes this pathfinder assume that the mob can float, or not
`void`
`setCanOpenDoors(boolean canOpenDoors)`
Allows this pathfinder to pass through closed doors, or not
`void`
`setCanPassDoors(boolean canPassDoors)`
Allows this pathfinder to pass through open doors, or not
`void`
`stopPathfinding()`
Instructs the Entity to stop trying to navigate to its current desired location

## Method Details

### getEntity

@NotNull @NotNull Mob getEntity()

Returns:
  The entity that is controlled by this pathfinder

### stopPathfinding

void stopPathfinding()
Instructs the Entity to stop trying to navigate to its current desired location

### hasPath

boolean hasPath()
If the entity is currently trying to navigate to a destination, this will return true

Returns:
  true if the entity is navigating to a destination

### getCurrentPath

@Nullable @Nullable Pathfinder.PathResult getCurrentPath()

Returns:
  The location the entity is trying to navigate to, or null if there is no destination

### findPath

@Nullable @Nullable Pathfinder.PathResult findPath(@NotNull @NotNull Location loc)
Calculates a destination for the Entity to navigate to, but does not set it as the current target. Useful for calculating what would happen before setting it.

Parameters:
  `loc` - Location to navigate to
Returns:
  The closest Location the Entity can get to for this navigation, or null if no path could be calculated

### findPath

@Nullable @Nullable Pathfinder.PathResult findPath(@NotNull @NotNull LivingEntity target)
Calculates a destination for the Entity to navigate to to reach the target entity, but does not set it as the current target. Useful for calculating what would happen before setting it. The behavior of this PathResult is subject to the games pathfinding rules, and may result in the pathfinding automatically updating to follow the target Entity. However, this behavior is not guaranteed, and is subject to the games behavior.

Parameters:
  `target` - the Entity to navigate to
Returns:
  The closest Location the Entity can get to for this navigation, or null if no path could be calculated

### moveTo

default boolean moveTo(@NotNull @NotNull Location loc)
Calculates a destination for the Entity to navigate to, and sets it with default speed as the current target.

Parameters:
  `loc` - Location to navigate to
Returns:
  If the pathfinding was successfully started

### moveTo

default boolean moveTo(@NotNull @NotNull Location loc, double speed)
Calculates a destination for the Entity to navigate to, with desired speed as the current target.

Parameters:
  `loc` - Location to navigate to
  `speed` - Speed multiplier to navigate at, where 1 is 'normal'
Returns:
  If the pathfinding was successfully started

### moveTo

default boolean moveTo(@NotNull @NotNull LivingEntity target)
Calculates a destination for the Entity to navigate to to reach the target entity, and sets it with default speed. The behavior of this PathResult is subject to the games pathfinding rules, and may result in the pathfinding automatically updating to follow the target Entity. However, this behavior is not guaranteed, and is subject to the games behavior.

Parameters:
  `target` - the Entity to navigate to
Returns:
  If the pathfinding was successfully started

### moveTo

default boolean moveTo(@NotNull @NotNull LivingEntity target, double speed)
Calculates a destination for the Entity to navigate to to reach the target entity, and sets it with specified speed. The behavior of this PathResult is subject to the games pathfinding rules, and may result in the pathfinding automatically updating to follow the target Entity. However, this behavior is not guaranteed, and is subject to the games behavior.

Parameters:
  `target` - the Entity to navigate to
  `speed` - Speed multiplier to navigate at, where 1 is 'normal'
Returns:
  If the pathfinding was successfully started

### moveTo

default boolean moveTo(@NotNull @NotNull Pathfinder.PathResult path)
Takes the result of a previous pathfinding calculation and sets it as the active pathfinding with default speed.

Parameters:
  `path` - The Path to start following
Returns:
  If the pathfinding was successfully started

### moveTo

boolean moveTo(@NotNull @NotNull Pathfinder.PathResult path, double speed)
Takes the result of a previous pathfinding calculation and sets it as the active pathfinding,

Parameters:
  `path` - The Path to start following
  `speed` - Speed multiplier to navigate at, where 1 is 'normal'
Returns:
  If the pathfinding was successfully started

### canOpenDoors

boolean canOpenDoors()
Checks if this pathfinder allows passing through closed doors.

Returns:
  if this pathfinder allows passing through closed doors

### setCanOpenDoors

void setCanOpenDoors(boolean canOpenDoors)
Allows this pathfinder to pass through closed doors, or not

Parameters:
  `canOpenDoors` - if the mob can pass through closed doors, or not

### canPassDoors

boolean canPassDoors()
Checks if this pathfinder allows passing through open doors.

Returns:
  if this pathfinder allows passing through open doors

### setCanPassDoors

void setCanPassDoors(boolean canPassDoors)
Allows this pathfinder to pass through open doors, or not

Parameters:
  `canPassDoors` - if the mob can pass through open doors, or not

### canFloat

boolean canFloat()
Checks if this pathfinder assumes that the mob can float

Returns:
  if this pathfinder assumes that the mob can float

### setCanFloat

void setCanFloat(boolean canFloat)
Makes this pathfinder assume that the mob can float, or not

Parameters:
  `canFloat` - if the mob can float, or not