Recipes
Create machine recipes using Crafttweaker
Custom machine recipes can be made with Crafttweaker.
Create a .zs file in the scripts
folder (ex: custom_machine_recipes.zs
).
Then inside the .zs file you can use either <recipetype:custommachinery:custom_machine>.create(machine, time)
or
<recipetype:custommachinery:custom_craft>.create(machine, output)
Add some requirements to the builder then call .build();
to register the recipe.
You can also use .build(recipe_name);
to register the recipe with a custom name.
The recipe name can be any string in lowercase and without whitespace or special characters. Also two recipes can't have the same name.
Machine Recipe :
Craft recipe :
🔴DON'T FORGET THE SEMICOLON ";" AFTER THE BUILD METHOD🔴
Requirements
You can add various requirements by calling the methods below directly on the custom machine recipe builder.
FunctionSkyRequirements special properties
Some requirements (almost all) have various properties that can change its behavior.
To set these properties you must call one or several of the methods below immediately after the desired requirement. The properties will only be applied on the latest added requirement when the method is called.
If the latest added requirement doesn't support the property an error will be logged and nothing will happen (the property will be ignored).
Priority
Use the method below to set the priority of the recipe.
If this method is called several times only the latest will be used.
If this is called AFTER .jei()
(no need to be immediately after) this will act as the "jeiPriority" instead, defining the priority of the recipe to show in jei instead of the priority to be checked in the machine.
If no priority is set, the default value : 0
will be used.
The
priority
param must be an integer value.
Jei
If the method below is called, all requirements added after that will be added to the jei
property requirement list.
This action cannot be inverted, you must add all your recipe requirements before calling it.
Requirements added after this method will only be displayed in jei but not executed by the machine. Learn more here.
Reset on error
If the method below is called, the recipe will reset the machine instead of erroring when a requirement throw an error.
Note : When the machine is reset its inventory remains the same, but all already consumed inputs are lost.
Hide in JEI
Call the following method anywhere in your recipe builder (between .create()
and .build();
) to make the recipe hidden in JEI.
The recipe will still work in the machine but won't show in JEI.
Custom machine appearance
The following methods allow you to set a custom machine appearance that will be applied on the machine while this recipe is processing.
Each of the following properties are optional, just call those you need.
Custom machine gui
The following method allows you to add or replace some of the machine's gui elements while this recipe is processing.
Any gui element from CM and its addons can be used here.
When a machine process this recipe, all gui elements defined here will be added to the machine gui.
If a gui element defined here has the same id than another element defined in the machine json then it will replace it.
It is impossible to remove a gui element defined in the machine json, but you can replace it with an empty gui element instead.
Example :
Change the position of a slot gui element with id "input1", and replace the gui element with id "texture" by an empty gui element :