Class TickScheduler

java.lang.Object
codechicken.multipart.util.TickScheduler

public class TickScheduler extends Object
Used to Schedule ticks for MultiPart instances. You probably want MultiPart.scheduleTick(int) and RandomTickPart.

If 2 parts are scheduled on the same tick, there is no guarantee on which part will receive their update first. If a tick is scheduled and the owning chunk unloaded, and subsequently the scheduled time passes, the tick will be fired immediately on the next tick after the chunk loads. Created by covers1624 on 12/5/20.

  • Constructor Details

    • TickScheduler

      public TickScheduler()
  • Method Details

    • init

      public static void init()
    • scheduleTick

      public static void scheduleTick(MultiPart part, int ticks)
      Schedule a tick for the given part, relative to game time. It should be noted, that if the chunk is un-loaded whilst the tick is scheduled, it will be fired immediately on chunk load.
      Parameters:
      part - The part to receive a tick.
      ticks - The number of ticks in the future.
    • loadRandomTick

      public static void loadRandomTick(RandomTickPart part)
      Loads random ticks for the given part. Called from RandomTickPart.onWorldJoin().
      Parameters:
      part - The part.
    • loadRandomTick

      public static void loadRandomTick(RandomTickPart part, net.minecraft.world.level.chunk.LevelChunk chunk)
      Loads random ticks for the given part. Called from RandomTickPart.onWorldJoin().
      Parameters:
      part - The part.
      chunk - The chunk.