Class ProcessingBehavior
java.lang.Object
fr.robie.machineengine.api.machine.ProcessingBehavior
- All Implemented Interfaces:
MachineBehavior
A ready-made behavior for recipe machines: start the first recipe (registration order) whose
inputs are available, run it, deliver outputs, and optionally push outputs to a neighbor.
Sleeps whenever there is nothing to do.
- no startable recipe →
SchedulerState.WAITING - running without per-tick costs →
SchedulerState.SCHEDULEDuntil done - running with per-tick costs →
SchedulerState.ACTIVE - outputs do not fit (here or at the push target) →
SchedulerState.BLOCKED, retried everyretryTicks
-
Nested Class Summary
Nested classes/interfaces inherited from interface MachineBehavior
MachineBehavior.Factory -
Method Summary
Modifier and TypeMethodDescriptionvoidcatchUp(@NotNull MachineContext context, long ticks) Runs processes for the caught-up ticks, without pushing (own storages only, §18).static MachineBehavior.Factoryof(@NotNull RecipeType<ProcessingRecipe> recipeType, @NotNull ProcessBinding binding) static MachineBehavior.Factorypushing(@NotNull RecipeType<ProcessingRecipe> recipeType, @NotNull ProcessBinding binding, @NotNull RelativeSide side, long retryTicks) Also pushes the output storage into the neighbor onsideevery tick it runs.voidtick(@NotNull MachineContext context) Called each tick while the machine isSchedulerState.ACTIVE.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface MachineBehavior
onLoad, onRemove, onUnload, onWake
-
Method Details
-
of
@NotNull public static MachineBehavior.Factory of(@NotNull @NotNull RecipeType<ProcessingRecipe> recipeType, @NotNull @NotNull ProcessBinding binding) -
pushing
@NotNull public static MachineBehavior.Factory pushing(@NotNull @NotNull RecipeType<ProcessingRecipe> recipeType, @NotNull @NotNull ProcessBinding binding, @NotNull @NotNull RelativeSide side, long retryTicks) Also pushes the output storage into the neighbor onsideevery tick it runs. -
tick
Description copied from interface:MachineBehaviorCalled each tick while the machine isSchedulerState.ACTIVE.- Specified by:
tickin interfaceMachineBehavior
-
catchUp
Runs processes for the caught-up ticks, without pushing (own storages only, §18).- Specified by:
catchUpin interfaceMachineBehavior
-