# Creating a custom machine

### The json file

Custom Machines json files should be located in `datapacks/<datapack>/data/<namespace>/machines/<machine>.json`

* \<datapack> : The name of your datapack, can be whatever you want.
* \<namespace> : The namespace of your machine, must be lowercase without spaces or special characters.
* \<machine> : The id of your machine, must be lowercase without spaces or special characters except "\_" and "/".

Each machines loaded in the game should have a different ID, in the example above the machine Id is : `namespace:machine`

You can put any number of machines under the same namespace or separate them.

You can also use subfolders like : `datapacks/datapack/data/namespace/machines/tier1/machine.json` so the machine ID will be `namespace:tier1/machine`

Just remember that all the machines json files should be under the machines folder.

### Machine properties

\
The machine json has 2 mandatory properties and 6 optional properties.

#### Mandatory properties

<details>

<summary>Name</summary>

#### Name : `name`

#### Description :

The name of the machine, not to be confused with the ID of the machine (which is the path to the machine json).&#x20;

It will be the name of both the machine item and the jei category for this machine recipes.

&#x20;It will also be displayed in The One Probe when the player is pointing the machine block.&#x20;

The specified name must be a string, any characters are allowed (as long as Minecraft can parse it), it can also be a lang key or a [Text Component](/custom-machinery-1.18/misc/text-component.md) to add more customization options.

#### Examples :

```json5
//Raw string
"name": "My cool machine"

//Lang key
"name": "machine.example.cool"

//Text component
"name": {
    "text": "My cool machine",
    "color": "red"
}
```

</details>

{% content-ref url="/pages/ezrVH8UeY9Eobn3zSGI7" %}
[Machine Appearance](/custom-machinery-1.18/creating-custom-machines/machine-appearance.md)
{% endcontent-ref %}

#### Optional properties

<details>

<summary>Tooltips</summary>

#### Name : `tooltips`

#### Description :

A list of tooltips that will be displayed when the player cursor hover the machine item in a gui.&#x20;

The tooltips can be a raw string or a [Text Component](/custom-machinery-1.18/misc/text-component.md).&#x20;

Each tooltips of the list will be displayed in a new line.

#### Examples :

```json5
//Raw string
"tooltips": "That machine is really cool"

//List of strings
"tooltips": ["That machine is really cool", "Try it and see"]

//Text component
"tooltips": {
    "text": "That machine is really cool",
    "color": "red"
}

//List of text components
"tooltips": [
    {
        "text": "That machine is really cool",
        "color": "red"
    },
    {
        "text": "Try it and see",
        "bold": true
    }
]
```

</details>

{% content-ref url="/pages/6a6FczKmRdem0YsQbSBk" %}
[Machine components](/custom-machinery-1.18/creating-custom-machines/machine-components.md)
{% endcontent-ref %}

{% content-ref url="/pages/GBJMwgM520rcsKJ7i5J2" %}
[Machine GUI](/custom-machinery-1.18/creating-custom-machines/machine-gui.md)
{% endcontent-ref %}

{% content-ref url="/pages/OfzEhOX9fIB55sGGocgn" %}
[JEI Recipe GUI](/custom-machinery-1.18/creating-custom-machines/jei-recipe-gui.md)
{% endcontent-ref %}

{% content-ref url="/pages/Gub7Sj1BJHlbdo4BG5x4" %}
[Catalysts](/custom-machinery-1.18/creating-custom-machines/catalysts.md)
{% endcontent-ref %}

{% content-ref url="/pages/X1HdpnfzHqO2DtTSYuQX" %}
[Processor](/custom-machinery-1.18/creating-custom-machines/processor.md)
{% endcontent-ref %}

### Empty template

An empty template of a machine json with all it's properties.

{% code title="machine.json" %}

```json
{
    "name": "",
    "appearance": {},
    "tooltips": [],
    "components": [],
    "gui": [],
    "jei": [],
    "catalysts": []
}
```

{% endcode %}

### Examples

{% hint style="info" %}
You can download the test datapack [here](https://download-directory.github.io/?url=https%3A%2F%2Fgithub.com%2FFrinn38%2FCustom-Machinery%2Ftree%2F1.16.5%2Ftest_datapack).
{% endhint %}

See a few examples of custom machines in [the test datapack](https://github.com/Frinn38/Custom-Machinery/tree/1.16.5/test_datapack/data/custommachinery/machines).


---

# 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.18/creating-custom-machines/creating-a-custom-machine.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.
