# Craft recipe

### 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...

{% hint style="warning" %}
All "per\_tick" requirements can't be used with this recipe type.
{% endhint %}

### 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 :&#x20;

#### Mandatory properties

```json5
"type": "custommachinery:custom_craft" //Mandatory for defining a custom craft recipe.
```

<details>

<summary>Machine</summary>

#### Name : `machine`

#### Description :&#x20;

The machine this recipe is for.&#x20;

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.&#x20;

**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 :&#x20;

```json5
"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`

</details>

<details>

<summary>Output</summary>

#### Name : `output`

#### Description :&#x20;

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.

#### Example :&#x20;

The recipe will output 1 vanilla diamond.

```json
"output": "minecraft:diamond"
```

The recipe will output 4 vanilla gold ingots.

```json
"output": {
    "id": "minecraft:gold_ingot",
    "Count": 4
}
```

</details>

#### Optional properties

{% content-ref url="/pages/zqU1hKaofF5lpu2dVPeu" %}
[Requirements](/custom-machinery-1.19/recipes/requirements.md)
{% endcontent-ref %}

<details>

<summary>Jei</summary>

#### Name : `jei`

#### Description :&#x20;

An array of Requirements.&#x20;

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 :&#x20;

Define 2 recipe requirements that won't be processed by the recipe, but will be the only 2 shown in the jei recipe gui.

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

</details>

<details>

<summary>Priority</summary>

#### Name : `priority`

#### Description :&#x20;

An integer between -2147483648 and 2147483647 that define which recipe will be used by the machine if several recipes pass all requirement checks.&#x20;

The recipe with the highest priority will be used.&#x20;

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 :&#x20;

This recipe will be loaded before any recipe with a priority < 1000.

```json
"priority": 1000
```

</details>

<details>

<summary>Jei priority</summary>

#### Name : `jeiPriority`

#### Description :&#x20;

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 :&#x20;

This recipe will show in jei before any recipes with a priority < 1000.

```json
"jeiPriority": 1000
```

</details>

<details>

<summary>Hidden</summary>

#### Name : `hidden`

#### Description :&#x20;

If true the recipe will be hidden in JEI recipe gui.

#### Default : `false`

#### Example :&#x20;

The recipe will be hidden in JEI :&#x20;

```json
"hidden": true
```

</details>

### Template

A default recipe template with all properties specified :&#x20;

```json5
{
    "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 :

```json5
{
    "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
    }]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://frinn.gitbook.io/custom-machinery-1.19/recipes/craft-recipe.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
