> For the complete documentation index, see [llms.txt](https://frinn.gitbook.io/custom-machinery-1.21/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://frinn.gitbook.io/custom-machinery-1.21/misc/i-o-config.md).

# I/O Config

Some components have a `config` property that you can define in the machine json.

This property can be used to define the default Input/Output (I/O) sides for the component.

Supported components :&#x20;

* [Energy component](/custom-machinery-1.21/creating-custom-machines/machine-components/energy-component.md)
* [Fluid component](/custom-machinery-1.21/creating-custom-machines/machine-components/fluid-component.md)
* [Item component](/custom-machinery-1.21/creating-custom-machines/machine-components/item-component.md)
* [Chemical component (Mekanism)](/custom-machinery-1.21/creating-custom-machines/machine-components/chemical-component-mekanism.md)

{% hint style="info" %}
This property will define the default I/O mode of the component for each side of the machine, but these I/O modes can be changed later in game by the player if you add a [config element](/custom-machinery-1.21/creating-custom-machines/machine-gui/config-element.md) to the machine GUI.
{% endhint %}

### Side modes

You can configure the I/O mode of a specific component for each sides of the machine.

Available sides are : top, bottom, front, back, right, left

{% hint style="info" %}
The machine `front` side is the side that faced the player when the machine was placed.
{% endhint %}

You can also use `default` to configure each sides that aren't specified.

#### Available I/O modes :&#x20;

* `input` : only input
* `output` : only output
* `both` : input and output
* `none` : neither input nor output

### Auto input/output

Starting from CM 0.7.0 the machines now have the ability to auto input/output items, fluids and energy from/to blocks next to the machine.

By default this behavior is disabled for items and fluids.

For energy components the default behavior is to auto input from all sides.

To enable or disable auto I/O simply use :&#x20;

```json5
"config": {
    "input": true, //Enable auto-input
    "output": false, //Disable auto-output
}
```

### Disabling gui config

By default any player can change the side mode of a component, or activate auto I/O by using the config button (only if a [config gui element](/custom-machinery-1.21/creating-custom-machines/machine-gui/config-element.md) is present in the machine GUI).

You can prevent player to config a specific component by adding in the config :&#x20;

```json5
"enabled": false
```

### Color

By default when the config button is clicked, all configurable slots will turn blue. This can be changed using `color` property.

Color property support various formats, pick one of these :&#x20;

```json
//Full json object, values between 0 and 1
"color": {
    "alpha": 0.5,
    "red": 1,
    "green": 0,
    "blue": 0
}

//Array of color, the order is alpha, red, green, blue. Values between 0 and 1
"color": [0.5, 1, 0, 0]

//ARGB 32bit integer
"color": 2147418112

//Minecraft color names, only support a few colors listed here : https://minecraft.fandom.com/wiki/Formatting_codes
"color": "red"
```

Example of a config gui with a few colored slots.

<figure><img src="/files/fGyIhMt7nPlnwojLtAMH" alt=""><figcaption></figcaption></figure>

### Gui customization

You can completely customize the small popup gui that shows when clicking on a slot.

{% hint style="warning" %}
Each button textures (so all textures here except the background) must be placed under the path "assets/namespace/textures/gui/sprites/texture.png" then refereced as "namespace:texture".
{% endhint %}

Here is a list of properties that can be customized and their default values (all are optional and will use their default values if not specified) :&#x20;

```json
"gui": {
    "width": 96,
    "height": 96,
    "background": "custommachinery:textures/gui/sprites/config/background.png",
    "title": "custommachinery.gui.config.component",
    "exit": {
        "x": 5,
        "y": 5,
        "width": 9,
        "height": 9,
        "textures": {
            "texture": "custommachinery:config/exit_button",
            "texture_hovered": "custommachinery:config/exit_button_hovered"
        }
    },
    "top": {
        "x": 41,
        "y": 25,
        "width": 14,
        "height": 14,
        "textures": {
            "texture": "custommachinery:config/side_mode_button",
            "texture_hovered": "custommachinery:config/side_mode_button_hovered"
        }
    },
    "bottom": {
        "x": 41,
        "y": 57,
        "width": 14,
        "height": 14,
        "textures": {
            "texture": "custommachinery:config/side_mode_button",
            "texture_hovered": "custommachinery:config/side_mode_button_hovered"
        }
    },
    "left": {
        "x": 25,
        "y": 41,
        "width": 14,
        "height": 14,
        "textures": {
            "texture": "custommachinery:config/side_mode_button",
            "texture_hovered": "custommachinery:config/side_mode_button_hovered"
        }
    },
    "right": {
        "x": 57,
        "y": 41,
        "width": 14,
        "height": 14,
        "textures": {
            "texture": "custommachinery:config/side_mode_button",
            "texture_hovered": "custommachinery:config/side_mode_button_hovered"
        }
    },
    "front": {
        "x": 41,
        "y": 41,
        "width": 14,
        "height": 14,
        "textures": {
            "texture": "custommachinery:config/side_mode_button",
            "texture_hovered": "custommachinery:config/side_mode_button_hovered"
        }
    },
    "back": {
        "x": 25,
        "y": 57,
        "width": 14,
        "height": 14,
        "textures": {
            "texture": "custommachinery:config/side_mode_button",
            "texture_hovered": "custommachinery:config/side_mode_button_hovered"
        }
    },
    "none": {
        "x": 78,
        "y": 57,
        "width": 14,
        "height": 14,
        "textures": {
            "texture": "custommachinery:config/all_none_button",
            "texture_hovered": "custommachinery:config/all_none_button_hovered"
        }
    },
    "input": {
        "x": 18,
        "y": 75,
        "width": 28,
        "height": 14,
        "textures": {
            "texture": "custommachinery:config/auto_io_button",
            "texture_hovered": "custommachinery:config/auto_io_button_hovered"
        }
    },
    "output": {
        "x": 50,
        "y": 75,
        "width": 28,
        "height": 14,
        "textures": {
            "texture": "custommachinery:config/auto_io_button",
            "texture_hovered": "custommachinery:config/auto_io_button_hovered"
        }
    }
}
```

### Example :&#x20;

A component config that has the following properties :&#x20;

* Allow input from the left side.
* Allow output to the right side.
* All other sides (top, bottom, front and back) can't input or output.
* Auto input and output are enabled.
* The config can't be modified by the player with the gui config button.

```json5
{
    "type": "item",
    "mode": "input",
    "id": "slot1",
    "config": {
        "default": "none",
        "right": "output",
        "left": "input",
        "input": true,
        "output": true,
        "enabled": false
    }
}
```

All sides are optional.

`default` will act for all sides that are not specified.

If `default` is not specified `both` mode will be used.
