TickScheduler API
ModMIT

TickScheduler API

A library for managing tick scheduling

41
Downloads
0
Followers
3 months ago
Updated
📦
2
Versions

📖About TickScheduler API

TickScheduler is a lightweight Tick library for mods:

  • run code in the future
  • repeat actions every N ticks
  • execute logic when conditions become true
  • persist tasks across world reloads
  • offload heavy work to async threads

FULL INFO ON GITHUB:

You can use it to:

  • temporary effects
  • cooldown timers
  • delayed world events
  • repeating logic loops
  • async computations
  • persistent timers
  • condition-triggered routines
  • modular systems requiring precise tick control

Commands:

  • /scheduler debug
  • /scheduler profiler on
  • /scheduler profiler off
  • /scheduler profiler stats
  • /scheduler save
  • /scheduler load
  • /scheduler tasks
  • /scheduler test <- for test lib

API classes:

SchedulerAPI - High-level scheduling interface
TickScheduler - Internal engine
Types - Task types, context, builder, priorities
PersistentStorage - Save & load persistent tasks
ConditionScheduler- Condition-based logic
TaskRegistry - Restore persistent task types

Example: Custom persistent task

SchedulerAPI.builder()
    .delay(60)
    .repeat(10)
    .maxRuns(5)
    .priority(Types.Priority.HIGH)
    .persistent()
    .type("regenerate")
    .submit(ctx -> {
        System.out.println("Regenerating at " + ctx.tick);
    });

Persistent tasks survive world reloads.
Profiler measures real execution time of scheduled tasks.


Port on NeoForge and on 1.21.1 later maybe...