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 :
//Create the builder
<recipetype:custommachinery:custom_machine>.create("namespace:machine_id", 20)
// Add requirements here
.build(); //Build and register the recipe
.build(recipe_name); //Same as above but you can set a custom recipe name.Craft recipe :
//Create the builder
<recipetype:custommachinery:custom_craft>.create("namespace:machine_id", <item:minecraft:diamond>)
// Add requirements here
.build(); //Build and register the recipe
.build(recipe_name); //Same as above but you can set a custom recipe name.🔴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.
Item
Use one of these methods to add an Item Requirement to the recipe.
The
itemparam must be an IItemStack. Example :<item:minecraft:diamond> * 5The
slotparam must be a string corresponding to a slot id defined in a custom machine json Item Componentslotproperty. It is optional and the default value is""(no specific slot required).The
tagparam must be a CT item tag brackets. Example :<tag:items:forge:stone>The
amountparam must be a positive integer.The
nbtparam must be a IData. Example :{tag1: 1}. It is optional and the default value is no tag required. This param MUST be specified if you want to use theslotparam after.
Item transform
Use one of these methods to add an Item transform requirement to the recipe.
The
input and outputparams must be an IItemStack. Example :<item:minecraft:diamond> * 5The
inputSlotandoutputSlotparams must be a string corresponding to a slot id defined in a custom machine json Item Componentslotproperty. It is optional and the default value is""(no specific slot required).The
tagparam must be a CT item tag brackets. Example :<tag:items:forge:stone>The
inputAmountparam must be a positive integer.The
inputNBTparam must be a IData. Example :{tag1: 1}. It is optional and the default value is no tag required. This param MUST be specified if you want to use theslotparam after.
Durability
Use one of these methods to add a Durability Requirement to the recipe.
The
itemparam must be an IItemStack. Example :<item:minecraft:diamond> * 5The
slotparam must be a string corresponding to a slot id defined in a custom machine json Item Componentslotproperty. It is optional and the default value is""(no specific slot required).The
tagparam must be a CT item tag brackets. Example :<tag:items:forge:stone>The
amountparam must be a positive integer.The
nbtparam must be a IData. Example :{tag1: 1}. It is optional and the default value is no tag required. This param MUST be specified if you want to use theslotparam after.
Fluid
Use one of these methods to add a Fluid Requirement to the recipe.
The
fluidparam must be a CT Fluid. Example :<fluid:minecraft:water>The
amountparam must be a positive long.The
nbtparam must be a IData. Example :{tag1: 1}. If you don't want the item to have a nbt you can passnull.The
tankparam must be a string corresponding to a tank id defined in a custom machine json Fluid Componenttankproperty. It is optional and the default value is no specific slot.The
tagparam must be a CT fluid tag brackets. Example :<tag:fluids:minecraft:water>
Energy
Use one of these methods to add an Energy Requirement to the recipe.
The
amountparam must be a positive integer.
Time
Use one of these methods to add a Time Requirement to the recipe.
The
timeparam must be a string that represent a time Range. Look at the Time Requirement wiki page to know what to put here.
Position
Use one of these methods to add a Position Requirement to the recipe.
The
x,yandzparams must be a valid range. Use""if you want to allow any value for an axis.
Biome
Use one of these methods to add a Biome Requirement to the recipe.
The
biomeparam must be a biome brackets. Example :<biome:minecraft:ocean>
Dimension
Use one of these methods to add a Dimension Requirement to the recipe.
The
dimensionparam must be a string defining a valid dimension id. Example :minecraft:overworld
Fuel
Use this method to add a Fuel Requirement to the recipe.
The
amountparam must be a positive integer that define the amount of fuel burned each tick of the recipe processing. Default to 1 when not specified.
Command
Use one of these methods to add a Command Requirement to the recipe.
The
commandparam must be a string starting by/which will be run as a command.The
permissionLevelparam must be a positive integer. Default :2The
logparam must be a boolean, if true the command will be logged in admin chat as a system command. Default :false
Effect
Use one of these methods to add an Effect Requirement to the recipe.
The
effectparam must be a Effect brackets. Example :<effect:minecraft:regeneration>The
timeandradiusparams must be a positive integer.The
levelparam must be a positive integer. Default :1The
filterparam must be an array of entity types. Example :[<entitytype:minecraft:cow>, <entitytype:minecraft:pig>"]Default :[]
Weather
Use one of these methods to add a Weather Requirement to the recipe.
The
weatherparam must be a string defining the required weather. Valid values :clear,rain,snow,thunder
Redstone
Use one of these methods to add a Redstone Requirement to the recipe.
The
powerparam must be a valid range that define the acceptable redstone signals to start the recipe.
Light
Use one of these methods to add a Light Requirement to the recipe.
The
amountparam must be a positive integer between 0 and 15.The
rangeparam must be a string defining a valid Range.
Entity
Use one of these methods to add an Entity Requirement to the recipe.
The
amountandradiusparams must be a positive integer.The
filterparam must be an array of entity types. Example :[<entitytype:minecraft:cow>, <entitytype:minecraft:pig>"...]Default :[]The
whitelistparam must be a boolean, if true the filter will be a whitelist, if false it will be a blacklist.
Block
Use one of these methods to add a Block Requirement to the recipe.
The
blockparam must be a string defining a valid blockstate. Using the formatnamespace:block_id[property1=value1,property2=value2...]{tag1: value1, tag2: value2...}(The [] and {} are optional) This is the block that will be placed.The
filterparam must be an arrays of string defining a valid blockstate. This is the blocks that the machine can/can't break depending on the whitelist property.The
whitelistparam must be a boolean, if true the filter property will be a whitelist, if false a blacklist. Default to false when not specified.The
startX,startY,startZ,endX,endY,endZmust be integer values defining the box where the machine will search for blocks. You can use the in-gameBox Creatorto select a box and put the values here.The
amountparam must be a positive integer. Default :1The
comparatorparam must be a string defining a valid Comparator Mode. Default :==
Loot Table
Use one of these methods to add a Loot Table Requirement to the recipe.
The
loot_tableparam must be a string path that point to a loot table. The loot table file must be loaded with a datapack or a loader mod. Example:custommachinery:my_test_loottablepoint to a file indata/custommachinery/loot_tables/my_test_loottable.jsonThe
luckparam must be a float. Default is 0.0 and it can be used in the loot table to alter the quantity of generated items.
Drop
Use one of these methods to add a Drop Requirement to the recipe.
The
itemparam must be an IItemStack. Example :<item:minecraft:diamond> * 5The
amountparam must be a positive integer, it represents the amount of items checked/consumed.The
radiusparam must be a positive integer, it represents the maximum distance to the machine the items will be searched.The
filterparam must be an array of IItemStack. Example :[<item:minecraft:diamond> * 5, <item:minecraft:cobblestone>]. It represents a whitelist of items to search.The
whitelistparam must be a boolean, if set tofalsethe filter will be a blacklist instead of a whitelist.
Requirements 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).
Chance
Use this method to add a chance property to the latest added requirement.
The
chanceparam must be a double between 0.0 and 1.0 included.
Supported requirements :
Block
Command
Drop
Durability
Effect
Energy
Energy Per Tick
Entity
Fluid
Fluid Per Tick
Function
Item
Delay
Use this method to set a delay for the requirement action.
The requirement will only execute its action after the specified delay.
The
delayparam must be a double between 0.0 and 1.0 excluded. 0 represent the start of the recipe and 1 represent its end.
Supported requirements :
Block
Command
Drop
Effect
Entity
Function
Display info
Specify a custom requirement display info by calling the following method after a requirement :
Example : Add a diamond icon with a tooltip

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
priorityparam 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 :
Examples :
Last updated

