# Chemical component (Mekanism)

{% hint style="warning" %}
This component requires [Custom Machinery Mekanism](https://www.curseforge.com/minecraft/mc-mods/custom-machinery-mekanism) to be installed.
{% endhint %}

This components is used to make the machine able to hold Mekanism chemicals.

It is compatible with Mekanism pressurized pipes and any other mods that use the same system.

Basically adding this component to the machine json will add a chemical tank to the machine.

{% hint style="info" %}
You can add as much as you want chemical components to your machine.

Each component will act as a separate chemical tank.
{% endhint %}

{% hint style="info" %}
Starting from 1.21.1 all 4 Mekanism chemicals (gas, infusion, slurry and pigment) are now merged into a single "chemical" type.
{% endhint %}

Chemical component is defined with `"type": "custommachinery:chemical"` in the json.

### Properties

The chemical component has 3 mandatory properties and 10 optional properties :&#x20;

#### Mandatory properties

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

<details>

<summary>Capacity</summary>

#### Name : `capacity`

#### Description :&#x20;

A positive integer value that define the amount of chemical that can be stored in the tank (Volume in Forge mB, with 1000mB being 1 Bucket)

#### Example :&#x20;

```json5
"capacity": 10000 //This component will be able to store 10000mB.
```

</details>

<details>

<summary>Id</summary>

#### Name : `id`

#### Desccription :&#x20;

A string that define the id of the tank (used in the gui element and recipes), the String must be all lowercase with letters and numbers only (no spaces or special characters).

#### Example :&#x20;

```json5
"id": "tank1"
```

</details>

#### Optional properties

<details>

<summary>Max input</summary>

#### Name : `maxInput`

#### Description :&#x20;

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

#### Default :&#x20;

The `capacity` of the tank.

#### Example :&#x20;

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

</details>

<details>

<summary>Min input</summary>

#### Name : `minInput`

#### Description :&#x20;

A positive integer that represent the min mB that can be input in the tank during a single tick.

If something (a pipe or the machine's auto-input) try to insert less than the specified amount the transfer will fail and nothing will be inserted.&#x20;

#### Default : `0`

#### Example :&#x20;

```json5
"minInput": 1000 //The machine will accept at least 1000mB/tick.
```

</details>

<details>

<summary>Max output</summary>

#### Name : `maxOutput`

#### Description :&#x20;

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

#### Default :&#x20;

The `capacity` of the tank.

#### Example :&#x20;

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

</details>

<details>

<summary>Min output</summary>

#### Name : `minOutput`

#### Description :&#x20;

A positive integer that represent the min mB that can be output from the tank during a single tick.

If something (a pipe or the machine's auto-output) try to extract less than the specified amount the transfer will fail and nothing will be extracted.&#x20;

#### Default : `0`

#### Example :&#x20;

```json5
"minOutput": 1000 //The machine will extract at least 1000mB/tick.
```

</details>

<details>

<summary>Whitelist</summary>

#### Name : `whitelist`

#### Description :&#x20;

A list of chemicals that the component can accept.&#x20;

The chemicals must be referenced by their registry name like `mekanism:steam` or `mekanism:redstone`.

You can also use a tag here using the # prefix like `#mekanism:dirty`

#### Default : empty

All chemicals are accepted by the component.

#### Example :&#x20;

```json5
"whitelist": ["mekanism:steam", "#mekanism:dirty"]
```

The component will accept only steam gas and chemicals in the mekanism:dirty tag.

Note : The blacklist (see below) takes priority over the whitelist. If a chemical is in both the blacklist and whitelist it won't be accepted by the component.

</details>

<details>

<summary>Blacklist</summary>

#### Name : `blacklist`

#### Description :&#x20;

A blacklist of chemicals that the component can't accept.&#x20;

The chemicals must be referenced by their registry name like `mekanism:steam` or `mekanism:redstone`.

You can also use a tag here using the # prefix like `#mekanism:dirty`

#### Default : empty

All chemicals are accepted by the component.

#### Example :&#x20;

```json5
"blacklist": ["mekanism:steam", "#mekanism:dirty"]
```

The slot will accept all chemicals but steam gas and chemicals in the mekanism:dirty tag.

Note : The blacklist takes priority over the whitelist (see above). If a chemical is in both the blacklist and whitelist it won't be accepted by the component.

</details>

<details>

<summary>Mode</summary>

#### Name : `mode`

#### Description :&#x20;

The IO mode of the tank, used only by recipes to know which tanks are inputs and outputs.

Available modes are (input/output/both/none).&#x20;

While crafting the machine will search for chemicals to consume in input tanks and put the recipe results in the output tanks.

For changing I/O mode of a tank for external interaction, such as buckets and pipes see the [Config](https://frinn.gitbook.io/custom-machinery-1.21/misc/i-o-config) property below.

#### Default : `both`

#### Example :&#x20;

```json5
"mode": "input" //Set the tank as an input tank.
```

</details>

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

<details>

<summary>Unique</summary>

#### Name : `unique`

#### Description :&#x20;

A boolean property (true/false) that define if the chemical component can accept a chemical that is already in another chemical component in the same machine.

If the component is set as "unique" a player won't be able to insert a chemical that is already in another tank, even if that tank is full (basically prevent overfill).

#### Default : `false`

The chemical component won't care if the fluid is already in another tank.

#### Example :&#x20;

The chemical component won't accept chemical that already are in another component.

```json
"unique": true
```

</details>

<details>

<summary>Radiations</summary>

#### Name : `radiations`

#### Description :&#x20;

A boolean property (true/false) that define if the chemical component will emit radiations when the machine is broken.

If set to true, radiations will be emitted when the machine is broken only if that chemical component contains a radioactive chemical.

The amount of radiations released depends of the chemical and the amount stored.

It works the same as when a Mekanism tank/pipe/machine is broken while containing radioactive chemicals.

#### Default : `false`

The radioactive chemicals will be voided without releasing radiations.

#### Example :&#x20;

```json
"radiations": true
```

</details>

### Example

An example of gas chemical component that can store 10000mB of sulfuric acid only, send 1000mB/tick and receive 666mB/tick.

```json5
{
    "type": "custommachinery:chemical",
    "capacity": 10000,
    "id": "tank1",
    "maxInput": 666,
    "maxOutput": 1000,
    "whitelist": "mekanism:sulfuric_acid"
}
```
