# Fluid component

This is the component that will let your machine interact with the Forge Fluid system (like tanks, pipes and so).

It is compatible with any other mods that use the same system (so about all of them) so any pipes will be able to pump fluids in and out of the machine.

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

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

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

Fluid component is defined with `"type": "custommachinery:fluid"` in the json.

### Properties

The fluid component has 3 mandatory properties and 5 optional properties :&#x20;

#### Mandatory properties

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

<details>

<summary>Capacity</summary>

#### Name : `capacity`

#### Description :&#x20;

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

#### 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>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>Filter</summary>

#### Name : `filter`

#### Description :&#x20;

A blacklist of fluids that the tank can't accept.&#x20;

The fluids must be referenced by their registry name like `minecraft:water` or `minecraft:lava`.&#x20;

By default the blacklist is empty so all fluids are accepted.

You can also use tag here with the # prefix like `#minecraft:water`

#### Default :&#x20;

No filter, so all fluids are accepted by the tank.

#### Example :&#x20;

```json5
"filter": "#minecraft:water" //The tank will accept all fluids that are not in the vanilla water tag.
```

</details>

<details>

<summary>Whitelist</summary>

#### Name : `whitelist`

#### Description :&#x20;

A boolean, if true the filter property will act as a whitelist instead of a blacklist, meaning that only fluids specified in the whitelist will be accepted by the fluid component.

#### Default : `false`

The filter property is a blacklist.

#### Example :&#x20;

```json5
"whitelist": true //The filter property is a whitelist.
```

</details>

<details>

<summary>Mode</summary>

#### Name : `mode`

#### Description :&#x20;

The IO mode of the tank.&#x20;

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

Pipes can only insert in an input tank and extract from an output tank.&#x20;

With a bucket you can both insert and extract fluids in an input tank but only extract fluids from an output tank.&#x20;

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

#### Default : `both`

#### Example :&#x20;

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

#### Note :&#x20;

An input tank will have a `maxOutput` value of 0 even if you set it to another value in the m`axOutput` property, same goes for output tank and `maxInput` property.

</details>

### Example

An example of Fluid Component that can store 10000mB of lava only, send 1000mB/tick and receive 666mB/tick.

```json5
{
    "type": "custommachinery:fluid",
    "capacity": 10000,
    "id": "lavatank",
    "maxInput": 666,
    "maxOutput": 1000,
    "filter": ["minecraft:lava"],
    "whitelist": true
}
```
