Class AbstractNavigation
java.lang.Object
de.Keyle.MyPet.api.entity.ai.navigation.AbstractNavigation
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
FieldsModifier and TypeFieldDescriptionprotected final NavigationParametersMutable parameter set controlling speed and modifiers. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractNavigation(double walkSpeed) Creates a navigation instance with default parameters at the given base walk speed.AbstractNavigation(NavigationParameters parameters) Creates a newAbstractNavigationinstance. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidPushes the currentNavigationParameters(speed, modifiers, water-avoidance) onto the underlying Bukkit mob.Mutable parameter set controlling speed and modifiers.abstract booleannavigateTo(double x, double y, double z) Starts pathfinding toward the given world coordinates.booleannavigateTo(LivingEntity entity) Convenience overload — navigates toward a living entity's current position.booleannavigateTo(Location loc) Convenience overload — navigates to the given location's block coordinates.abstract voidstop()Cancels any active pathfinding and halts the pet.abstract voidtick()Called once per pet tick to perform any per-frame navigation bookkeeping (e.g., re-applying parameters, checking path completion).
-
Field Details
-
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'sMOVEMENT_SPEEDattribute)
-
-
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. -
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
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
-