# Energy component

This is the component that let your machine interact with the Forge Energy system, it is compatible with most modern mods (IC2 excluded) so any mods that use FE or RF will be able to insert or extract energy to and from your machine.

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

If you try to define more than 1 energy component only the last will be used.

Energy component is defined with `"type": "custommachinery:energy"` in the json.

### Properties

The energy component has 2 mandatory property and 3 optional properties :&#x20;

#### Mandatory properties

```json5
"type": "custommachinery:energy" //Mandatory to define an energy component.
```

<details>

<summary>Capacity</summary>

#### Name : `capacity`

#### Description :&#x20;

A positive long that represent the amount of energy the machine can store.

Max value : 9,223,372,036,854,775,807

#### Example :&#x20;

```json5
"capacity": 10000 //The machine can store 10000FE.
```

</details>

#### Optional properties

<details>

<summary>Max input</summary>

#### Name : `maxInput`

#### Description :&#x20;

A positive integer that represent the max FE that can be input in the machine during a single tick.

#### Default :&#x20;

The `capacity` of the machine.

#### Example :&#x20;

```json5
"maxInput": 1000 //The machine can accept 1000FE/tick.
```

</details>

<details>

<summary>Max output</summary>

#### Name : `maxOutput`

#### Description :&#x20;

A positive integer that represent the max FE that can be output from the machine during a single tick.

#### Default :&#x20;

The `capacity` of the machine.

#### Example :&#x20;

```json5
"maxOutput": 1000 //The machine can give 1000FE/tick.
```

</details>

{% content-ref url="../../misc/config" %}
[config](https://frinn.gitbook.io/custom-machinery-1.19/misc/config)
{% endcontent-ref %}

### Example

An example of an Energy Component that will allow the machine to store 100000FE, input 1000FE and output 666FE.

```json5
{
    "type": "custommachinery:energy",
    "capacity": 100000,
    "maxInput": 1000,
    "maxOutput": 666
}
```

You just have to put that in the `components` array in the machine json.

### Notes

The energy generated/consumed by a recipe is not counted in the maxInput/maxOutput value and will bypass it.

Only energy inserted/extracted by a cable or another machine will be counted.

If the `maxOutput` property is greater than 0 the machine will try to send its stored energy to any energy receiver next to it.
