Craft recipe
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)/recipes/
(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/recipes/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)/recipes/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.
Optional properties
RequirementsTemplate
A default recipe template with all properties specified :
{
"type": "custommachinery:custom_craft",
"machine": "namespace:my_machine",
"output": "item_id",
"requirements": [],
"jei": [],
"priority": 1000,
"jeiPriority": 1000
}
Example
A recipe that takes 64 coals and 1000FE and output a diamond :
{
"type": "custommachinery:custom_craft",
"machine": "custommachinery:my_machine",
"output": "minecraft:diamond",
"requirements": [
{
"type": "custommachinery:item",
"mode": "input",
"item": "minecraft:coal",
"amount": 64
},
{
"type": "custommachinery:energy",
"mode": "input",
"amount": 1000
}]
}
Last updated