Interface SchedulerSource
- All Known Subinterfaces:
Ageable, Angerable, Animal, Bat, CaveSpider, Chicken, Chunk, Cow, Creeper, CubeMob, Damageable, Drowned, Enderman, Endermite, Entity, ExperienceOrb, Frostbite, Husk, ItemEntity, LivingEntity, MagmaCube, Mob, Mooshroom, Pig, Player, Shearable, Sheep, Silverfish, Slime, Spider, SulfurCube, Zombie
public interface SchedulerSource
Something bound to a region of the world, on whose thread tasks can be scheduled: an entity or a chunk.
The tasks of an entity run in the order they were scheduled, on the region holding the entity when they run, following it across regions.
A task that was scheduled either runs or is retired, never both: it is retired when its source is removed, or its region can no longer run it, before the task's turn. The retired callback may run on any thread.
- Since:
- 0.1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanSchedules a task to run as soon as possible on the region thread owning this source.booleanSchedules a task to run as soon as possible on the region thread owning this source.default booleanexecuteDelayed(Runnable task, long delayTicks) Schedules a task to run on the region thread owning this source, after a delay.booleanexecuteDelayed(Runnable task, Runnable retired, long delayTicks) Schedules a task to run on the region thread owning this source, after a delay.booleanChecks whether the calling thread may safely touch this source.
-
Method Details
-
execute
Schedules a task to run as soon as possible on the region thread owning this source.- Parameters:
task- the task to run- Returns:
falseif the source is removed and the task was not scheduled- Since:
- 0.1.0
-
execute
Schedules a task to run as soon as possible on the region thread owning this source.- Parameters:
task- the task to runretired- called instead of the task if it can no longer run- Returns:
falseif the source is removed: neithertasknorretiredwill run- Since:
- 0.1.0
-
executeDelayed
Schedules a task to run on the region thread owning this source, after a delay.- Parameters:
task- the task to rundelayTicks- the minimum number of ticks to wait before running the task- Returns:
falseif the source is removed or the task could not be scheduled- Since:
- 0.1.0
-
executeDelayed
Schedules a task to run on the region thread owning this source, after a delay.- Parameters:
task- the task to runretired- called instead of the task if it can no longer rundelayTicks- the minimum number of ticks to wait before running the task- Returns:
falseif the source is removed or the task could not be scheduled: neithertasknorretiredwill run- Since:
- 0.1.0
-
isOwnedByCurrentThread
boolean isOwnedByCurrentThread()Checks whether the calling thread may safely touch this source.- Returns:
trueif the calling thread is the region thread owning this source- Since:
- 0.1.0
-