Class CombinedAttackGoal
java.lang.Object
net.minestom.server.entity.ai.GoalSelector
net.minestom.server.entity.ai.goal.CombinedAttackGoal
Allows entity to perform both melee and ranged attacks.
-
Field Summary
Fields inherited from class net.minestom.server.entity.ai.GoalSelector
entityCreature -
Constructor Summary
ConstructorsConstructorDescriptionCombinedAttackGoal(@NotNull EntityCreature entityCreature, int meleeRange, int rangedRange, double rangedPower, double rangedSpread, int delay, TemporalUnit timeUnit, int desirableRange, boolean comeClose) CombinedAttackGoal(@NotNull EntityCreature entityCreature, int meleeRange, int rangedRange, double rangedPower, double rangedSpread, Duration delay, int desirableRange, boolean comeClose) CombinedAttackGoal(@NotNull EntityCreature entityCreature, int meleeRange, int meleeDelay, TemporalUnit meleeTimeUnit, int rangedRange, double rangedPower, double rangedSpread, int rangedDelay, TemporalUnit rangedTimeUnit, int desirableRange, boolean comeClose) CombinedAttackGoal(@NotNull EntityCreature entityCreature, int meleeRange, Duration meleeDelay, int rangedRange, double rangedPower, double rangedSpread, Duration rangedDelay, int desirableRange, boolean comeClose) -
Method Summary
Modifier and TypeMethodDescriptionvoidend()Ends thisGoalSelector.voidsetProjectileGenerator(Function<Entity, EntityProjectile> projectileGenerator) booleanWhether or not thisGoalSelectorshould end.booleanWhether or not thisGoalSelectorshould start.voidstart()Starts thisGoalSelector.voidtick(long time) Called every tick when thisGoalSelectoris running.Methods inherited from class net.minestom.server.entity.ai.GoalSelector
findTarget, getAIGroup, getEntityCreature, setEntityCreature
-
Constructor Details
-
CombinedAttackGoal
public CombinedAttackGoal(@NotNull @NotNull EntityCreature entityCreature, int meleeRange, int rangedRange, double rangedPower, double rangedSpread, int delay, TemporalUnit timeUnit, int desirableRange, boolean comeClose) - Parameters:
entityCreature- the entity to add the goal to.meleeRange- the allowed range the entity can hit others in melee.rangedRange- the allowed range the entity can shoot others.rangedPower- shot power (1 for normal).rangedSpread- shot spread (0 for best accuracy).delay- the delay between any attacks.timeUnit- the unit of the delay.desirableRange- the desirable range: the entity will try to stay no further than this distance.comeClose- if entity should go as close as possible to the target whether target is not in line of sight for a ranged attack.
-
CombinedAttackGoal
public CombinedAttackGoal(@NotNull @NotNull EntityCreature entityCreature, int meleeRange, int rangedRange, double rangedPower, double rangedSpread, Duration delay, int desirableRange, boolean comeClose) - Parameters:
entityCreature- the entity to add the goal to.meleeRange- the allowed range the entity can hit others in melee.rangedRange- the allowed range the entity can shoot others.rangedPower- shot power (1 for normal).rangedSpread- shot spread (0 for best accuracy).delay- the delay between any attacks.desirableRange- the desirable range: the entity will try to stay no further than this distance.comeClose- if entity should go as close as possible to the target whether target is not in line of sight for a ranged attack.
-
CombinedAttackGoal
public CombinedAttackGoal(@NotNull @NotNull EntityCreature entityCreature, int meleeRange, int meleeDelay, TemporalUnit meleeTimeUnit, int rangedRange, double rangedPower, double rangedSpread, int rangedDelay, TemporalUnit rangedTimeUnit, int desirableRange, boolean comeClose) - Parameters:
entityCreature- the entity to add the goal to.meleeRange- the allowed range the entity can hit others in melee.meleeDelay- the delay between melee attacks.meleeTimeUnit- the unit of the melee delay.rangedRange- the allowed range the entity can shoot others.rangedPower- shot power (1 for normal).rangedSpread- shot spread (0 for best accuracy).rangedDelay- the delay between ranged attacks.rangedTimeUnit- the unit of the ranged delay.desirableRange- the desirable range: the entity will try to stay no further than this distance.comeClose- if entity should go as close as possible to the target whether target is not in line of sight for a ranged attack.
-
CombinedAttackGoal
public CombinedAttackGoal(@NotNull @NotNull EntityCreature entityCreature, int meleeRange, Duration meleeDelay, int rangedRange, double rangedPower, double rangedSpread, Duration rangedDelay, int desirableRange, boolean comeClose) - Parameters:
entityCreature- the entity to add the goal to.meleeRange- the allowed range the entity can hit others in melee.meleeDelay- the delay between melee attacks.rangedRange- the allowed range the entity can shoot others.rangedPower- shot power (1 for normal).rangedSpread- shot spread (0 for best accuracy).rangedDelay- the delay between ranged attacks.desirableRange- the desirable range: the entity will try to stay no further than this distance.comeClose- if entity should go as close as possible to the target whether target is not in line of sight for a ranged attack.
-
-
Method Details
-
getCooldown
-
setProjectileGenerator
-
shouldStart
public boolean shouldStart()Description copied from class:GoalSelectorWhether or not thisGoalSelectorshould start.- Specified by:
shouldStartin classGoalSelector- Returns:
- true to start
-
start
public void start()Description copied from class:GoalSelectorStarts thisGoalSelector.- Specified by:
startin classGoalSelector
-
tick
public void tick(long time) Description copied from class:GoalSelectorCalled every tick when thisGoalSelectoris running.- Specified by:
tickin classGoalSelector- Parameters:
time- the time of the update in milliseconds
-
shouldEnd
public boolean shouldEnd()Description copied from class:GoalSelectorWhether or not thisGoalSelectorshould end.- Specified by:
shouldEndin classGoalSelector- Returns:
- true to end
-
end
public void end()Description copied from class:GoalSelectorEnds thisGoalSelector.- Specified by:
endin classGoalSelector
-