Skip to content

Recipes

Frinn38 edited this page Nov 11, 2021 · 9 revisions

Creating the Custom Machine Recipe Json

Custom Machines Recipe jsons must be located in (your_datapack)/data/(namespace)/recipes/ (the same place as the vanilla recipes).

The (namespace) is a folder that can have any name.

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 : your_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 : (your_datapack)/data/(namespace)/recipes/machine1/my_recipe.json so the recipe ID will be namespace:machine1/my_recipe

Just remember that all the recipe jsons should be under the recipes folder.

Recipe json properties

The Recipe Json have 3 mandatory properties and 3 optional properties.

Type (Mandatory)

Description : The type of recipe, this is what will tell the game "This is a Custom Machine Recipe, load it with the Custom Machine Recipe loader instead of the vanilla loader.

Value : "type": "custommachinery:custom_machine" This must be in any Custom Machine Recipes or the recipe will not load !

machine (Mandatory)

Description : The machine this recipe is for. You can set only one machine here so if you want the same recipe to work for differents 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 (your_datapack)/data/namespace/machines/my_machine.json

time (Mandatory)

Description : An integer that define the duration of the recipe in Ticks.

Example : "time": 200 The recipe will takes 10 seconds to be completed since there is 20 ticks in 1 second (if the server doesn't lag).

Note : Increasing the recipe time will increase any per-ticks input costs and outputs.

requirements (Optional but the recipe will be useless without it)

Description : An array of Requirements. Requirements are basically the inputs and outputs of a recipe (like items/fluids/energy). See the wiki page of each requirements for more informations. You can add as much requirements as you want.

Default : No requirements will be provided for this recipe, making it useless (the machine will just run without consuming or producing anything)

Note : Each requirement must have a "type" property that define it's type (see the differents types in each requirement own page). Requirements must also have a "mode" property that define it's IO mode, available modes are input and output.

Example :

"requirements": [
    {
        "type": "requirement1",
        "mode": "input"
    },
    {
        "type": "requirement2",
        "mode": "output"
    }
]

jei (Optional)

Description : An array of Requirements. 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 :

"jei": [
    {
        "type": "requirement1",
        "mode": "input"
    },
    {
        "type": "requirement2",
        "mode": "output"
    }
]

Priority (Optional)

Description : 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 : "priority": 1000 This recipe will be loaded before any recipe with a priority < 1000.

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 : "jeiPriority": 1000" This recipe will show in jei before any recipes with a priority < 1000.

Example

A recipe that takes a diamond and turn it into energy :

{
    "type": "custommachinery:custom_machine",
    "machine": "custommachinery:my_machine",
    "time": 1000,
    "requirements": [
    {
        "type": "custommachinery:item",
        "mode": "input",
        "item": "minecraft:diamond",
        "amount": 1
    },
    {
        "type": "custommachinery:energy",
        "mode": "output",
        "amount": 1000
    }]
}

Clone this wiki locally