Function
Use the function requirement in a CT recipe
//These imports are needed, put these 2 lines on top of the script.
import mods.custommachinery.Context;
import mods.custommachinery.Machine;
//Executed when the machine is idle and search a recipe to process.
//Returning success will allow the machine to process this recipe (if all other requirements allow it as well).
//Returning error will prevent the machine to process this recipe (the machine will keep searching for another valid recipe).
.requireFunctionToStart((ctx as Context) => {return ctx.success()})
//Executed the first tick of the crafting process.
//Returning success will allow the machine to continue to process this recipe.
//Returning error will put the machine in error status and display the provided error message.
.requireFunctionOnStart((ctx as Context) => {return ctx.success()})
//Executed each tick of the crafting process.
//Returning success will allow the machine to continue to process this recipe.
//Returning error will put the machine in error status and display the provided error message.
.requireFunctionEachTick((ctx as Context) => {return ctx.success()})
//Executed the last tick of the crafting process.
//Returning success will allow the machine to continue to process this recipe.
//Returning error will put the machine in error status and display the provided error message.
.requireFunctionOnEnd((ctx as Context) => {return ctx.success()})Example
Last updated