# Chemical (Mekanism)

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

Chemical requirement is used to define Mekanism chemicals inputs and outputs in a custom machine recipe.

To use it you need to provide the registry name and the amount (in mB, with 1000mB being 1 Bucket) of the chemical you want the recipe to consume/produce.

This requirement is available in both `input` and `output` modes.

In input mode : When starting to craft the recipe, the machine will consume the desired amount of the specified chemical from the input tank it's in.

In output mode : When finishing to craft the recipe, the machine will produce the desired amount of the specified chemical and put it in the first disponible tank.

If the requirement is `_per_tick` the specified amount will be consumed/produced each tick instead of once.

#### All of Mekanism chemicals types are supported :&#x20;

* Gas
* Infusion
* Pigment
* Slurry

The type of chemical is defined in the `type` property (see below).

### Properties

The chemical requirements has 4 mandatory properties and 2 optional properties.

#### Mandatory properties

```json
"type": "custommachinery:gas" //Mandatory to define a gas requirement.
OR
"type": "custommachinery:gas_per_tick" //Mandatory to define a gas per tick requirement.
OR
"type": "custommachinery:infusion" //Mandatory to define an infusion requirement.
OR
"type": "custommachinery:infusion_per_tick" //Mandatory to define an infusion per tick requirement.
OR
"type": "custommachinery:pigment" //Mandatory to define a pigment requirement.
OR
"type": "custommachinery:pigment_per_tick" //Mandatory to define a pigment per tick requirement.
OR
"type": "custommachinery:slurry" //Mandatory to define a slurry requirement.
OR
"type": "custommachinery:slurry_per_tick" //Mandatory to define a slurry per tick requirement.
```

<details>

<summary>Mode</summary>

#### Name : `mode`

#### Description :

Define the I/O mode of the requirement.

* `input` The requirement will consume the specified amount of the specified chemical.
* `output` The requirement will produce the specified amount of the specified chemical.

#### Example :

```json
"mode": "input"
```

</details>

<details>

<summary>Chemical</summary>

#### Name : `chemical`

#### Description :&#x20;

The registry name of the chemical you want to be consumed/produced by the recipe.

It must be specified like `namespace:registry_name` with "namespace" being either "mekanism" if the fluid is from Mekanism or another mod ID if the chemical is from an addon.

#### Example :&#x20;

```json
"chemical": "mekanism:sulfuric_acid"
```

The chemical consumed/produced by the recipe will be Mekanism sulfuric acid (gas).

</details>

<details>

<summary>Amount</summary>

#### Name : `amount`

#### Description :&#x20;

A positive integer that define the amount of the specified chemical you want to be consumed/produced.&#x20;

It can be any positive number but remember that the machine need enough tank capacity to input/output the chemical.

#### Example :&#x20;

```json
"amount": 1000
```

The recipe will consume/produce 1000mB of the specified chemical.

</details>

#### Optional properties

<details>

<summary>Chance</summary>

#### Name : `chance`

#### Description :

A double between 0.0 and 1.0 that define the chance of the requirement to be processed.

#### Default : 1

The requirement will always be processed.

#### Example :

```json
"chance": 0.7
```

The requirement will have 70% chance to be processed.

</details>

<details>

<summary>Tank</summary>

#### Name : `tank`

#### Description :&#x20;

The tank id of a tank you want to force the player to put the chemical in. The tank id **must be exactly the same** as the one specified in the [Chemical Component ID property](/custom-machinery-1.19/creating-custom-machines/machine-components/chemical-component-mekanism.md#name-id) or it will not work. If the requirement mode is "output" the produced chemical will be put in the specified tank.

#### Default : `empty`

The chemical can be put in any tank.

#### Example :&#x20;

```json
"tank": "input1"
```

The chemical will be input/output only in the tank with id `input1`.

</details>

### Example

A gas chemical requirement that will make the custom machine recipe produce 500mB of Mekanism sulfuric acid with 50% chance :

```json
{
    "type": "custommachinery:gas",
    "mode": "output",
    "chemical": "mekanism:sulfuric_acid",
    "amount": 500,
    "chance": 0.5
}
```


---

# 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.19/recipes/requirements/chemical-mekanism.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.
