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
-
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(EntityTask other) abstract void
end
(GlowLivingEntity entity) Invoked when this task is being ended for this entity.abstract void
execute
(GlowLivingEntity entity) Invoked each tick when this task is being executed for this entity.abstract int
The maximum duration of this task.abstract int
The minimum duration of this task.getName()
The name of this EntityTask.boolean
Whether this task is currently being executed.abstract boolean
Whether this task is instant.boolean
isPaused()
Whether this task is paused.final void
pause
(GlowLivingEntity entity) Pauses this task for this entity.final void
pulse
(GlowLivingEntity entity) Advances this task by a tick on the given entity.void
reset
(GlowLivingEntity entity) Resets the progress of this task for this entity.final void
resume
(GlowLivingEntity entity) Resumes the previously paused task for this entity.abstract boolean
shouldStart
(GlowLivingEntity entity) Whether the task should begin executing for this entity.abstract void
start
(GlowLivingEntity entity) Invoked when this task is about to start for this entity.
-
Constructor Details
-
EntityTask
-
-
Method Details
-
compareTo
- Specified by:
compareTo
in 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.
-