Class RangedAttackGoal
java.lang.Object
net.minestom.server.entity.ai.GoalSelector
net.minestom.server.entity.ai.goal.RangedAttackGoal
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
The function used to generate a projectile. -
Field Summary
Fields inherited from class net.minestom.server.entity.ai.GoalSelector
entityCreature
-
Constructor Summary
ConstructorDescriptionRangedAttackGoal
(@NotNull EntityCreature entityCreature, int delay, int attackRange, int desirableRange, boolean comeClose, double power, double spread, @NotNull TemporalUnit timeUnit) RangedAttackGoal
(@NotNull EntityCreature entityCreature, Duration delay, int attackRange, int desirableRange, boolean comeClose, double power, double spread) -
Method Summary
Modifier and TypeMethodDescriptionvoid
end()
Ends thisGoalSelector
.void
setProjectileGenerator
(Function<Entity, EntityProjectile> projectileGenerator) void
setProjectileGenerator
(RangedAttackGoal.ProjectileGenerator projectileGenerator) boolean
Whether or not thisGoalSelector
should end.boolean
Whether or not thisGoalSelector
should start.void
start()
Starts thisGoalSelector
.void
tick
(long time) Called every tick when thisGoalSelector
is running.Methods inherited from class net.minestom.server.entity.ai.GoalSelector
findTarget, getAIGroup, getEntityCreature, setEntityCreature
-
Constructor Details
-
RangedAttackGoal
public RangedAttackGoal(@NotNull @NotNull EntityCreature entityCreature, int delay, int attackRange, int desirableRange, boolean comeClose, double power, double spread, @NotNull @NotNull TemporalUnit timeUnit) - Parameters:
entityCreature
- the entity to add the goal to.delay
- the delay between each shots.attackRange
- the allowed range the entity can shoot others.desirableRange
- the desirable range: the entity will try to stay no further than this distance.comeClose
- whether entity should go as close as possible to the target whether target is not in line of sight.power
- shot power (1 for normal).spread
- shot spread (0 for best accuracy).timeUnit
- the unit of the delay.
-
RangedAttackGoal
public RangedAttackGoal(@NotNull @NotNull EntityCreature entityCreature, Duration delay, int attackRange, int desirableRange, boolean comeClose, double power, double spread) - Parameters:
entityCreature
- the entity to add the goal to.delay
- the delay between each shots.attackRange
- the allowed range the entity can shoot others.desirableRange
- the desirable range: the entity will try to stay no further than this distance.comeClose
- whether entity should go as close as possible to the target whether target is not in line of sight.power
- shot power (1 for normal).spread
- shot spread (0 for best accuracy).
-
-
Method Details
-
getCooldown
-
setProjectileGenerator
-
setProjectileGenerator
-
shouldStart
public boolean shouldStart()Description copied from class:GoalSelector
Whether or not thisGoalSelector
should start.- Specified by:
shouldStart
in classGoalSelector
- Returns:
- true to start
-
start
public void start()Description copied from class:GoalSelector
Starts thisGoalSelector
.- Specified by:
start
in classGoalSelector
-
tick
public void tick(long time) Description copied from class:GoalSelector
Called every tick when thisGoalSelector
is running.- Specified by:
tick
in classGoalSelector
- Parameters:
time
- the time of the update in milliseconds
-
shouldEnd
public boolean shouldEnd()Description copied from class:GoalSelector
Whether or not thisGoalSelector
should end.- Specified by:
shouldEnd
in classGoalSelector
- Returns:
- true to end
-
end
public void end()Description copied from class:GoalSelector
Ends thisGoalSelector
.- Specified by:
end
in classGoalSelector
-