Package codechicken.multipart.util
Class TickScheduler
java.lang.Object
codechicken.multipart.util.TickScheduler
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidinit()static voidloadRandomTick(RandomTickPart part) Loads random ticks for the given part.static voidloadRandomTick(RandomTickPart part, net.minecraft.world.level.chunk.LevelChunk chunk) Loads random ticks for the given part.static voidscheduleTick(MultiPart part, int ticks) Schedule a tick for the given part, relative to game time.
-
Constructor Details
-
TickScheduler
public TickScheduler()
-
-
Method Details
-
init
public static void init() -
scheduleTick
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
Loads random ticks for the given part. Called fromRandomTickPart.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 fromRandomTickPart.onWorldJoin().- Parameters:
part- The part.chunk- The chunk.
-