The basics of creating a custom craft recipe using json
Description
Custom craft recipes can be used to make the machine behave like a crafting table.
The machine must have one Item Component with "variant": "custommachinery:result".
When all requirements checks, like time, weather, biome etc... are passed, the output item will appear in the result slot.
When the output item is taken out of the result slot by a player (this can't be automated) all requirements are processed, i.e. energy/fluid/items are consumed etc...
All "per_tick" requirements can't be used with this recipe type.
Location
Custom craft recipe jsons must be located in (my_datapack)/data/(namespace)/recipe/ (the same place as the vanilla recipes).
The (namespace) is a folder that can have any name, but must be all lowercase without spaces or special characters.
The machine name must be all lowercase with no spaces or any other characters than letters and numbers but you can use "_" or "/". The file must be a .json file.
Example : my_datapack/data/namespace/recipe/my_recipe.json
Each recipes loaded in the game must have a different ID, in the example above the recipe Id is : namespace:my_recipe
You can put any number of recipes under the same namespace or separate them.
You can also use subfolders like : (my_datapack)/data/(namespace)/recipe/machine1/my_recipe.json so the recipe ID will be namespace:machine1/my_recipe
Just remember that all the recipe json should be under the recipes folder.
Properties
The recipe json has 3 mandatory properties and 5 optional properties :
Mandatory properties
"type": "custommachinery:custom_craft"//Mandatory for defining a custom craft recipe.
Machine
Name : machine
Description :
The machine this recipe is for.
You can set only one machine here so if you want the same recipe to work for different machines you must write the recipe for each machine and change this property.
You must use here the Machine ID and not the machine name.
If the machine ID is wrong or the machine doesn't exist the recipe will still load but it will be unusable in-game.
Example :
"machine": "namespace:my_machine"
This recipe will be set for the machine with ID "namespace:my_machine".
Reminder : "namespace:my_machine" is the machine located in (datapack)/data/namespace/machines/my_machine.json
Output
Name : output
Description :
The item that will be output by this recipe.
This can just be the id of the item to output, or an object with both the id and the Count of items to craft.
A tag property can also be added to define the nbt of the output item.
The requirements are specified exactly as in the requirements property above.
Requirements specified here will not be processed by the machine, they will just display in the jei recipe.
The requirements specified here will override the requirements specified in the "requirements" property, so if this property is specified only its requirements will show in jei.
Default : empty
Example :
Define 2 recipe requirements that won't be processed by the recipe, but will be the only 2 shown in the jei recipe gui.
An integer between -2147483648 and 2147483647 that define which recipe will be used by the machine if several recipes pass all requirement checks.
The recipe with the highest priority will be used.
If several recipes pass the requirement checks and have the same priority the first loaded recipe will be used, this depends of the datapack order and can be a bit random so if you want to be sure of which recipe will be used first you must use the priority property.
Default : 0
Example :
This recipe will be loaded before any recipe with a priority < 1000.
"priority": 1000
Jei priority
Name : jeiPriority
Description :
An integer between -2147483648 and 2147483647 that define which recipe will show first in jei, recipes with higher values will show before recipes with lower values.
Default : 0
Example :
This recipe will show in jei before any recipes with a priority < 1000.
"jeiPriority": 1000
Hidden
Name : hidden
Description :
If true the recipe will be hidden in JEI recipe gui.
Default : false
Example :
The recipe will be hidden in JEI :
"hidden": true
Template
A default recipe template with all properties specified :