Class AbstractNavigation

java.lang.Object
de.Keyle.MyPet.api.entity.ai.navigation.AbstractNavigation

public abstract class AbstractNavigation extends Object
Abstraction over the pathfinding/movement system for a pet entity.

Goals (movement, attack, follow) interact with the pet's locomotion exclusively through this class rather than calling Bukkit's Pathfinder API directly. This allows the navigation layer to apply speed modifiers, water-avoidance, and parameter syncing in one place.

The concrete implementation (PaperNavigation in the plugin module) delegates to the Paper Pathfinder and manages the MOVEMENT_SPEED attribute on the underlying Bukkit Mob.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final NavigationParameters
    Mutable parameter set controlling speed and modifiers.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractNavigation(double walkSpeed)
    Creates a navigation instance with default parameters at the given base walk speed.
    Creates a new AbstractNavigation instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    Pushes the current NavigationParameters (speed, modifiers, water-avoidance) onto the underlying Bukkit mob.
    Mutable parameter set controlling speed and modifiers.
    abstract boolean
    navigateTo(double x, double y, double z)
    Starts pathfinding toward the given world coordinates.
    boolean
    Convenience overload — navigates toward a living entity's current position.
    boolean
    Convenience overload — navigates to the given location's block coordinates.
    abstract void
    Cancels any active pathfinding and halts the pet.
    abstract void
    Called once per pet tick to perform any per-frame navigation bookkeeping (e.g., re-applying parameters, checking path completion).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • parameters

      protected final NavigationParameters parameters
      Mutable parameter set controlling speed and modifiers. Goals may cache this reference and adjust modifiers (e.g. sprint boost) without re-fetching.
  • Constructor Details

    • AbstractNavigation

      public AbstractNavigation(double walkSpeed)
      Creates a navigation instance with default parameters at the given base walk speed.
      Parameters:
      walkSpeed - base movement speed (blocks/tick multiplier applied to the mob's MOVEMENT_SPEED attribute)
    • AbstractNavigation

      public AbstractNavigation(NavigationParameters parameters)
      Creates a new AbstractNavigation instance.
      Parameters:
      parameters - Mutable parameter set controlling speed and modifiers. Goals may cache this reference and adjust modifiers (e.g. sprint boost) without re-fetching.
  • Method Details

    • stop

      public abstract void stop()
      Cancels any active pathfinding and halts the pet. Goals call this when their target becomes invalid or the goal is interrupted.
    • applyNavigationParameters

      public abstract void applyNavigationParameters()
      Pushes the current NavigationParameters (speed, modifiers, water-avoidance) onto the underlying Bukkit mob. Called after parameter changes to ensure the entity's attribute values reflect the latest state.
    • tick

      public abstract void tick()
      Called once per pet tick to perform any per-frame navigation bookkeeping (e.g., re-applying parameters, checking path completion). The pet's scheduler invokes this — goals do not need to call it manually.
    • getParameters

      public NavigationParameters getParameters()
      Mutable parameter set controlling speed and modifiers. Goals may cache this reference and adjust modifiers (e.g. sprint boost) without re-fetching.
      Returns:
      the live parameter set; mutating it affects this navigation