# Redstone component

Redstone component let you interact with the vanilla redstone logic system. It doesn't store anything on the machine, instead it can be used to define the redstone behavior of the machine.

This component is fully optional, if not added the machine won't react or emit redstone signal.

{% hint style="warning" %}
Redstone component is defined as a **unique** machine component, meaning that you can only have 1 per machine.
{% endhint %}

If you try to add more than 1 redstone component only the last will be used.

{% hint style="info" %}
Use the `config` property to specify which sides will input or output redstone signal.
{% endhint %}

Redstone component is defined with `"type": "custommachinery:redstone"` in the machine json.

### Properties

The redstone component has 1 mandatory property and 7 optional properties :&#x20;

#### Mandatory property

```json5
"type": "custommachinery:redstone" //Mandatory to define a redstone component.
```

#### Optional property

<details>

<summary>Power to pause</summary>

#### Name : `powertopause`

#### Description :&#x20;

Define the redstone signal power needed to pause the machine.&#x20;

Put a number greater than 15 if you want the machine to never pause on redstone signal (since vanilla max redstone power is 15).

#### Default : 1

The machine will pause at any redstone signal.

#### Example :&#x20;

The machine will pause if a redstone signal of 5 or more is applied to it.

```json5
"powertopause": 5
```

</details>

<details>

<summary>Crafting power output</summary>

#### Name : `craftingpoweroutput`

#### Description :&#x20;

Define the redstone signal power emitted when the machine is processing a recipe.

#### Default : 0

The machine never emit redstone signal.

#### Example :&#x20;

The machine will emit a redstone signal of 15 when processing.

```json5
"craftingpoweroutput": 15
```

</details>

<details>

<summary>Idle power output</summary>

#### Name : `idlepoweroutput`

#### Description :&#x20;

Define the redstone signal power emitted when the machine is idle.

#### Default : 0

The machine never emit redstone signal.

#### Example :&#x20;

The machine will emit a redstone signal of 15 when idle.

```json5
"idlepoweroutput": 15
```

</details>

<details>

<summary>Errored power output</summary>

#### Name : `erroredpoweroutput`

#### Description :&#x20;

Define the redstone signal power emitted when the machine is errored.

#### Default : 0

The machine never emit redstone signal.

#### Example :&#x20;

The machine will emit a redstone signal of 15 when errored.

```json5
"erroredpoweroutput": 15
```

</details>

<details>

<summary>Comparator input type</summary>

#### Name : `comparatorinputtype`&#x20;

#### Description :&#x20;

&#x20;A component type that will be used to determine the redstone signal emitted by a vanilla comparator. All currently supported component types are :

* `custommachinery:item` Will output a signal corresponding to the item in it's slot, the same way the vanilla chest does.
* `custommachinery:fluid` Will output a signal corresponding to the amount of fluid in it's tank, 0 empty, 15 full, 8 half...
* `custommachinery:energy` Will output a signal corresponding to the amount of energy in it's buffer, 0 empty, 15 full, 8 half...

#### Default : `custommachinery:energy`

The comparator will output a redstone signal based on the machine energy buffer (if present), or 0 if the machine doesn't have an energy component.

#### Example :&#x20;

The comparator will output a redstone signal based on one of the machine internal fluid tank. Define the used fluid tank with the `comparatorinputid` property.

```json5
"comparatorinputtype": "custommachinery:fluid"
```

</details>

<details>

<summary>Comparator input id</summary>

#### Name : `comparatorinputid`

#### Description :&#x20;

Used with the `comparatorinputtype` property, define which component will be used in case of the component type specified is not single (so for items and fluid).

The id provided must be the same than the id defined in the component json. If no component can be found for this type and with this id, the comparator will output a redstone signal of 0.

#### Default : nothing

#### Example :&#x20;

The comparator will search for a component of the type defined in the `comparatorinputtype` property and with the id `input` and if found, will output a redstone signal based on this component.

```json5
"comparatorinputid": "input"
```

</details>

{% content-ref url="/pages/qhkQG0LIzUQkB48hMiYA" %}
[I/O Config](/custom-machinery-1.21/misc/i-o-config.md)
{% endcontent-ref %}

### Example

A redstone component that will make the machine :

* Output a redstone signal of 0 when idle
* Output a redstone signal of 7 when crafting
* Output a redstone signal of 14 when errored
* Pause when a redstone signal of 15 is received
* Nearby comparators will output a signal based on an item in a slot with id "input"

```json5
{
    "type": "custommachinery:redstone",
    "powertopause": 15,
    "craftingpoweroutput": 7,
    "erroredpoweroutput": 14,
    "comparatorinputtype": "custommachinery:item",
    "comparatorinputid": "input"
}
```


---

# 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.21/creating-custom-machines/machine-components/redstone-component.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.
