Class PathfinderAvoidEntity<T extends LivingEntity>
java.lang.Object
me.gamercoder215.mobchip.ai.goal.Pathfinder
me.gamercoder215.mobchip.ai.goal.PathfinderAvoidEntity<T>
- Type Parameters:
T- Class of Entities to avoid
- All Implemented Interfaces:
PathfinderInfo, Filtering<T>, SpeedModifier
public final class PathfinderAvoidEntity<T extends LivingEntity>
extends Pathfinder
implements Filtering<T>, SpeedModifier
Represents a Pathfinder to avoid a LivingEntity
-
Nested Class Summary
Nested classes/interfaces inherited from class Pathfinder
Pathfinder.PathfinderFlag -
Field Summary
Fields inherited from class Pathfinder
entityFields inherited from interface SpeedModifier
DEFAULT_SPEED_MODIFIER -
Constructor Summary
ConstructorsConstructorDescriptionPathfinderAvoidEntity(@NotNull Creature m, @NotNull Class<T> filter) Constructs a PathfinderAvoidEntity with a max distance of 5 and using the default speed modifiers.PathfinderAvoidEntity(@NotNull Creature m, @NotNull Class<T> filter, float dist, double mod) Constructs a PathfinderAvoidEntity with both modifiers the same.PathfinderAvoidEntity(@NotNull Creature m, @NotNull Class<T> filter, float dist, double walkMod, double sprintMod) Constructs a PathfinderAvoidEntity without any avoiding predicates.PathfinderAvoidEntity(@NotNull Creature m, @NotNull Class<T> filter, float dist, double walkMod, double sprintMod, @Nullable Predicate<T> avoidPredicate) Constructs a PathfinderAvoidEntity with only an avoid predicate.PathfinderAvoidEntity(@NotNull Creature m, @NotNull Class<T> filter, float dist, double walkMod, double sprintMod, @Nullable Predicate<T> avoidPredicate, @Nullable Predicate<T> avoidingPredicate) Constructs a PathfinderAvoidEntity. -
Method Summary
Modifier and TypeMethodDescriptionGets the current avoiding predicate.Gets the current avoid predicate.@NotNull CreatureGet the entity involved in this Pathfinder.Get the filter that this Pathfinder is looking for.@NotNull Pathfinder.PathfinderFlag[]getFlags()Fetches an Array of Flags that this Pathfinder has.Returns the pathfinder's internal name.floatGet the maximum distance needed to stop avoiding the target, in blocks (meters).doubleGet the Speed Modifier of this Pathfinder.doubleGets the current sprint modifier.voidsetAvoidingPredicate(@Nullable Predicate<T> avoidingPredicate) Sets the current avoiding predicate.voidsetAvoidPredicate(@Nullable Predicate<T> avoidPredicate) Sets the current avoid predicate.voidSet the Filter that this Pathfinder is looking for.voidsetMaxDistance(float dist) Sets the maximum distance needed to stop avoiding the target, in blocks (meters).voidsetSpeedModifier(double mod) Sets the Speed Modifier of this Pathfinder.voidsetSprintModifier(double mod) Sets the current Sprint Modifier.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PathfinderInfo
getName
-
Constructor Details
-
PathfinderAvoidEntity
public PathfinderAvoidEntity(@NotNull @NotNull Creature m, @NotNull @NotNull Class<T> filter) throws IllegalArgumentException Constructs a PathfinderAvoidEntity with a max distance of 5 and using the default speed modifiers.- Parameters:
m- Creature to usefilter- Filter of entity to avoid- Throws:
IllegalArgumentException- if filter is null
-
PathfinderAvoidEntity
public PathfinderAvoidEntity(@NotNull @NotNull Creature m, @NotNull @NotNull Class<T> filter, float dist, double mod) throws IllegalArgumentException Constructs a PathfinderAvoidEntity with both modifiers the same.- Parameters:
m- Creature to usefilter- Filter of entity to avoiddist- Maximum Distance away to stop fleeingmod- Sprinting/Walking away modifier- Throws:
IllegalArgumentException- if filter is null
-
PathfinderAvoidEntity
public PathfinderAvoidEntity(@NotNull @NotNull Creature m, @NotNull @NotNull Class<T> filter, float dist, double walkMod, double sprintMod) throws IllegalArgumentException Constructs a PathfinderAvoidEntity without any avoiding predicates.- Parameters:
m- Creature to usefilter- Filter of entity to avoiddist- Maximum Distance away to stop fleeingwalkMod- Walking away modifiersprintMod- Sprinting away modifier- Throws:
IllegalArgumentException- if filter is null
-
PathfinderAvoidEntity
public PathfinderAvoidEntity(@NotNull @NotNull Creature m, @NotNull @NotNull Class<T> filter, float dist, double walkMod, double sprintMod, @Nullable @Nullable Predicate<T> avoidPredicate) throws IllegalArgumentException Constructs a PathfinderAvoidEntity with only an avoid predicate.- Parameters:
m- Creature to usefilter- Filter of entity to avoiddist- Maximum Distance away to stop fleeingwalkMod- Walking away modifiersprintMod- Sprinting away modifieravoidPredicate- Predicate to check when determining the entity to avoid- Throws:
IllegalArgumentException- if filter is null
-
PathfinderAvoidEntity
public PathfinderAvoidEntity(@NotNull @NotNull Creature m, @NotNull @NotNull Class<T> filter, float dist, double walkMod, double sprintMod, @Nullable @Nullable Predicate<T> avoidPredicate, @Nullable @Nullable Predicate<T> avoidingPredicate) throws IllegalArgumentException Constructs a PathfinderAvoidEntity.- Parameters:
m- Creature to usefilter- Filter of entity to avoiddist- Maximum Distance away to stop fleeingwalkMod- Walking away modifiersprintMod- Sprinting away modifieravoidPredicate- Predicate to check when determining the entity to avoidavoidingPredicate- Predicate to check when determining if the entity should continue avoiding- Throws:
IllegalArgumentException- if filter is null
-
-
Method Details
-
getMaxDistance
public float getMaxDistance()Get the maximum distance needed to stop avoiding the target, in blocks (meters).- Returns:
- Max distance to stop avoiding
-
setMaxDistance
public void setMaxDistance(float dist) Sets the maximum distance needed to stop avoiding the target, in blocks (meters).- Parameters:
dist- New distance to set
-
getSpeedModifier
public double getSpeedModifier()Description copied from interface:SpeedModifierGet the Speed Modifier of this Pathfinder.- Specified by:
getSpeedModifierin interfaceSpeedModifier- Returns:
- Speed Modifier
-
getSprintModifier
public double getSprintModifier()Gets the current sprint modifier.- Returns:
- Sprint Modifier
-
setSprintModifier
public void setSprintModifier(double mod) Sets the current Sprint Modifier.- Parameters:
mod- Sprint Modifier
-
getAvoidPredicate
-
setAvoidPredicate
-
getAvoidingPredicate
-
setAvoidingPredicate
-
setSpeedModifier
public void setSpeedModifier(double mod) Description copied from interface:SpeedModifierSets the Speed Modifier of this Pathfinder.- Specified by:
setSpeedModifierin interfaceSpeedModifier- Parameters:
mod- Modifier to set
-
setFilter
-
getFilter
-
getEntity
Description copied from class:PathfinderGet the entity involved in this Pathfinder.- Overrides:
getEntityin classPathfinder- Returns:
- Creature involved
-
getFlags
Description copied from class:PathfinderFetches an Array of Flags that this Pathfinder has.
- Specified by:
getFlagsin classPathfinder- Returns:
- Array of Pathfinder Flags
-
getInternalName
Description copied from interface:PathfinderInfoReturns the pathfinder's internal name. This may match the actual NMS name of the pathfinder, but it may not.- Specified by:
getInternalNamein interfacePathfinderInfo- Returns:
- Internal Name
-