Class EntityTask

java.lang.Object
net.glowstone.entity.ai.EntityTask
All Implemented Interfaces:
Comparable<EntityTask>
Direct Known Subclasses:
FollowPlayerTask, LookAroundTask, LookAtPlayerTask

public abstract class EntityTask extends Object implements Comparable<EntityTask>
  • Constructor Details

    • EntityTask

      public EntityTask(@NonNls @NonNls String name)
  • Method Details

    • compareTo

      public int compareTo(EntityTask other)
      Specified by:
      compareTo in interface Comparable<EntityTask>
    • pulse

      public final void pulse(GlowLivingEntity entity)
      Advances this task by a tick on the given entity.
      Parameters:
      entity - the entity to run on
    • reset

      public void reset(GlowLivingEntity entity)
      Resets the progress of this task for this entity.
      Parameters:
      entity - the entity in question.
    • resume

      public final void resume(GlowLivingEntity entity)
      Resumes the previously paused task for this entity.
      Parameters:
      entity - the entity in question.
    • pause

      public final void pause(GlowLivingEntity entity)
      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

      public abstract boolean shouldStart(GlowLivingEntity entity)
      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

      public abstract void start(GlowLivingEntity entity)
      Invoked when this task is about to start for this entity.
      Parameters:
      entity - the entity in question.
    • end

      public abstract void end(GlowLivingEntity entity)
      Invoked when this task is being ended for this entity.
      Parameters:
      entity - the entity in question.
    • execute

      public abstract void execute(GlowLivingEntity entity)
      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

      public String 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.