# Crafting your machine

All the machines share the same item, with Id : `custommachinery:custom_machine_item` the machine the item will be linked to is defined with an item component (new system from Minecraft 1.21 that replace old nbt system).

The component id is `custommachinery:machine` and its value should be the machine id like: `custommachinery:power_crusher` (the namespace should always be included).

Vanilla json recipes, KubeJS have different ways to handle items components so I will put an example of each below.

The recipe will be: ![recipe](https://github.com/Frinn38/Custom-Machinery/raw/1.16.5/wiki/machine_recipe.png)

{% tabs %}
{% tab title="Forge json" %}
{% code title="recipe.json" %}

```json
{
    "type": "minecraft:crafting_shaped",
    "pattern":
    [
        "xxx",
        "x x",
        "xxx"
    ],
    "key":
    {
        "x":
        {
            "item": "minecraft:diamond"
        }
    },
    "result":
    {
        "id": "custommachinery:custom_machine_item",
        "count": 1,
        "components": {"custommachinery:machine":"custommachinery:power_crusher"}
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="KubeJS script" %}
{% code title="script.js" %}

```javascript
ServerEvents.recipes(event => {
    event.shaped('custommachinery:custom_machine_item[custommachinery:machine="custommachinery:tester"]'), [
        'DDD',
        'D D',
        'DDD'
    ], {
        'D': 'minecraft:diamond'
    })
})
```

{% endcode %}
{% endtab %}
{% endtabs %}
