Class RandomLookAroundGoal
java.lang.Object
net.minestom.server.entity.ai.GoalSelector
net.minestom.server.entity.ai.goal.RandomLookAroundGoal
-
Field Summary
Fields inherited from class net.minestom.server.entity.ai.GoalSelector
entityCreature -
Constructor Summary
ConstructorsConstructorDescriptionRandomLookAroundGoal(EntityCreature entityCreature, int chancePerTick) RandomLookAroundGoal(EntityCreature entityCreature, int chancePerTick, @NotNull Supplier<Integer> minimalLookTimeSupplier, @NotNull Function<EntityCreature, Vec> randomDirectionFunction) -
Method Summary
Modifier and TypeMethodDescriptionvoidend()Ends thisGoalSelector.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
-
RandomLookAroundGoal
-
RandomLookAroundGoal
public RandomLookAroundGoal(EntityCreature entityCreature, int chancePerTick, @NotNull @NotNull Supplier<Integer> minimalLookTimeSupplier, @NotNull @NotNull Function<EntityCreature, Vec> randomDirectionFunction) - Parameters:
entityCreature- Creature that should randomly look around.chancePerTick- The chance (per tick) that the entity looks around. Setting this to N would mean there is a 1 in N chance.minimalLookTimeSupplier- A supplier that returns the minimal amount of time an entity looks in a direction.randomDirectionFunction- A function that returns a random vector that the entity will look in/at.
-
-
Method Details
-
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
-