Interface MachineBehavior
- All Known Implementing Classes:
MultiblockMember, ProcessingBehavior
public interface MachineBehavior
Addon-provided logic of a machine (ARCHITECTURE.md ยง12). One instance per machine, created by the
type's
MachineBehavior.Factory. All methods run on the machine's owner thread.
Behaviors only touch the world through the MachineContext. State that must survive a
restart goes into MachineDataKeys, storages and the process slot, never into fields.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondefault voidcatchUp(@NotNull MachineContext context, long ticks) Called once after loading when the type'sCatchUpPolicycatches up:ticksis the time spent unloaded, capped.default voidonLoad(@NotNull MachineContext context) Called after the machine was placed or loaded, before it first ticks.default voidonRemove(@NotNull MachineContext context) Called when the machine is removed from the world.default voidonUnload(@NotNull MachineContext context) Called before the machine unloads (its chunk unloads or the server stops).default voidonWake(@NotNull MachineContext context, @NotNull WakeReason reason) Called before the first tick after waking up.voidtick(@NotNull MachineContext context) Called each tick while the machine isSchedulerState.ACTIVE.
-
Method Details
-
tick
Called each tick while the machine isSchedulerState.ACTIVE. -
onWake
Called before the first tick after waking up. -
onLoad
Called after the machine was placed or loaded, before it first ticks. -
onUnload
Called before the machine unloads (its chunk unloads or the server stops). -
catchUp
Called once after loading when the type'sCatchUpPolicycatches up:ticksis the time spent unloaded, capped. Must be closed-form and touch only the machine's own storages (no neighbors, no networks, no world). The machine is woken afterwards. -
onRemove
Called when the machine is removed from the world.
-