Interface SchedulerSource

All Known Subinterfaces:
Chunk, Damageable, Entity, LivingEntity, Mob, Player

public interface SchedulerSource
Something bound to a region of the world, on whose thread tasks can be scheduled: an entity or a chunk.

The target region is resolved when the task is scheduled: a task scheduled for an entity runs on the region that held the entity at that moment.

Since:
0.1.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Schedules a task to run as soon as possible on the region thread owning this source.
    boolean
    executeDelayed(Runnable task, long delayTicks)
    Schedules a task to run on the region thread owning this source, after a delay.
    boolean
    Checks whether the calling thread may safely touch this source.
  • Method Details

    • execute

      boolean execute(Runnable task)
      Schedules a task to run as soon as possible on the region thread owning this source.
      Parameters:
      task - the task to run
      Returns:
      false if the source is removed and the task was not scheduled
      Since:
      0.1.0
    • executeDelayed

      boolean executeDelayed(Runnable task, long delayTicks)
      Schedules a task to run on the region thread owning this source, after a delay.
      Parameters:
      task - the task to run
      delayTicks - the minimum number of ticks to wait before running the task
      Returns:
      false if the source is removed and the task was not scheduled
      Since:
      0.1.0
    • isOwnedByCurrentThread

      boolean isOwnedByCurrentThread()
      Checks whether the calling thread may safely touch this source.
      Returns:
      true if the calling thread is the region thread owning this source
      Since:
      0.1.0