Package me.gamercoder215.mobchip.ai.goal
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 me.gamercoder215.mobchip.ai.goal.Pathfinder
Pathfinder.PathfinderFlag
-
Field Summary
Fields inherited from class me.gamercoder215.mobchip.ai.goal.Pathfinder
entity
Fields inherited from interface me.gamercoder215.mobchip.ai.SpeedModifier
DEFAULT_SPEED_MODIFIER
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a PathfinderAvoidEntity with a max distance of 5 and using the default speed modifiers.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.Get the entity involved in this Pathfinder.Get the filter that this Pathfinder is looking for.getFlags()
Fetches an Array of Flags that this Pathfinder has.Returns the NMS Internal Name.float
Get the maximum distance needed to stop avoiding the target, in blocks (meters).double
Get the Speed Modifier of this Pathfinder.double
Gets the current sprint modifier.void
setAvoidingPredicate
(@Nullable Predicate<T> avoidingPredicate) Sets the current avoiding predicate.void
setAvoidPredicate
(@Nullable Predicate<T> avoidPredicate) Sets the current avoid predicate.void
Set the Filter that this Pathfinder is looking for.void
setMaxDistance
(float dist) Sets the maximum distance needed to stop avoiding the target, in blocks (meters).void
setSpeedModifier
(double mod) Sets the Speed Modifier of this Pathfinder.void
setSprintModifier
(double mod) Sets the current Sprint Modifier.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface me.gamercoder215.mobchip.ai.goal.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:SpeedModifier
Get the Speed Modifier of this Pathfinder.- Specified by:
getSpeedModifier
in 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
Gets the current avoid predicate.- Returns:
- Avoid Predicate used to determine the entity to avoid
-
setAvoidPredicate
Sets the current avoid predicate.- Parameters:
avoidPredicate
- Avoiding Predicate used to determine the entity to avoid
-
getAvoidingPredicate
Gets the current avoiding predicate.- Returns:
- Avoiding Predicate used to determine if the entity should continue avoiding
-
setAvoidingPredicate
Sets the current avoiding predicate.- Parameters:
avoidingPredicate
- Avoiding Predicate used to determine if the entity should continue avoiding
-
setSpeedModifier
public void setSpeedModifier(double mod) Description copied from interface:SpeedModifier
Sets the Speed Modifier of this Pathfinder.- Specified by:
setSpeedModifier
in interfaceSpeedModifier
- Parameters:
mod
- Modifier to set
-
setFilter
Description copied from interface:Filtering
Set the Filter that this Pathfinder is looking for.- Specified by:
setFilter
in interfaceFiltering<T extends LivingEntity>
- Parameters:
clazz
- Filter to set
-
getFilter
Description copied from interface:Filtering
Get the filter that this Pathfinder is looking for.- Specified by:
getFilter
in interfaceFiltering<T extends LivingEntity>
- Returns:
- Filter found
-
getEntity
Description copied from class:Pathfinder
Get the entity involved in this Pathfinder.- Overrides:
getEntity
in classPathfinder
- Returns:
- Creature involved
-
getFlags
Description copied from class:Pathfinder
Fetches an Array of Flags that this Pathfinder has.
- Specified by:
getFlags
in classPathfinder
- Returns:
- Array of Pathfinder Flags
-
getInternalName
Description copied from interface:PathfinderInfo
Returns the NMS Internal Name.- Specified by:
getInternalName
in interfacePathfinderInfo
- Returns:
- Internal Name
-