Package net.glowstone.entity.ai
Class EntityTask
java.lang.Object
net.glowstone.entity.ai.EntityTask
- All Implemented Interfaces:
Comparable<EntityTask>
- Direct Known Subclasses:
FollowPlayerTask,LookAroundTask,LookAtPlayerTask
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(EntityTask other) abstract voidend(GlowLivingEntity entity) Invoked when this task is being ended for this entity.abstract voidexecute(GlowLivingEntity entity) Invoked each tick when this task is being executed for this entity.abstract intThe maximum duration of this task.abstract intThe minimum duration of this task.getName()The name of this EntityTask.booleanWhether this task is currently being executed.abstract booleanWhether this task is instant.booleanisPaused()Whether this task is paused.final voidpause(GlowLivingEntity entity) Pauses this task for this entity.final voidpulse(GlowLivingEntity entity) Advances this task by a tick on the given entity.voidreset(GlowLivingEntity entity) Resets the progress of this task for this entity.final voidresume(GlowLivingEntity entity) Resumes the previously paused task for this entity.abstract booleanshouldStart(GlowLivingEntity entity) Whether the task should begin executing for this entity.abstract voidstart(GlowLivingEntity entity) Invoked when this task is about to start for this entity.
-
Constructor Details
-
EntityTask
-
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<EntityTask>
-
pulse
Advances this task by a tick on the given entity.- Parameters:
entity- the entity to run on
-
reset
Resets the progress of this task for this entity.- Parameters:
entity- the entity in question.
-
resume
Resumes the previously paused task for this entity.- Parameters:
entity- the entity in question.
-
pause
Pauses this task for this entity.- Parameters:
entity- the entity in question.
-
getDurationMin
public abstract int getDurationMin()The minimum duration of this task. This value is ignored if this task is instant.- Returns:
- the minimum duration of this task, in ticks.
-
getDurationMax
public abstract int getDurationMax()The maximum duration of this task. This value is ignored if this task is instant.- Returns:
- the maximum duration of this task, in ticks.
-
shouldStart
Whether the task should begin executing for this entity.- Parameters:
entity- the entity in question.- Returns:
- true if the task should start, false otherwise.
-
start
Invoked when this task is about to start for this entity.- Parameters:
entity- the entity in question.
-
end
Invoked when this task is being ended for this entity.- Parameters:
entity- the entity in question.
-
execute
Invoked each tick when this task is being executed for this entity.- Parameters:
entity- the entity in question.
-
isInstant
public abstract boolean isInstant()Whether this task is instant. An "instant" task will be executed every tick while the entity is alive.- Returns:
- the entity in question.
-
getName
The name of this EntityTask. Must be unique to each EntityTask implementation.- Returns:
- the name of this EntityTask.
-
isExecuting
public boolean isExecuting()Whether this task is currently being executed.- Returns:
- true if this task is being executed, false otherwise.
-
isPaused
public boolean isPaused()Whether this task is paused.- Returns:
- whether this task is paused.
-