> For the complete documentation index, see [llms.txt](https://frinn.gitbook.io/custom-machinery-1.16/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://frinn.gitbook.io/custom-machinery-1.16/recipes/upgrades/modifiers.md).

# Modifiers

Requirement modifiers are used to tweak some properties of a recipe requirement.

They are defined in json inside of the `modifiers` property of the machine upgrade item json.

### List of properties that can be modified

<table><thead><tr><th width="150">Requirement</th><th width="150" align="center">Target</th><th align="center">Modified property </th></tr></thead><tbody><tr><td><a href="/pages/S4xcVvoL3mzDQdulJjdz">Block</a></td><td align="center">-</td><td align="center"><code>amount</code></td></tr><tr><td><a href="/pages/S4xcVvoL3mzDQdulJjdz">Block</a></td><td align="center">"chance"</td><td align="center"><code>chance</code></td></tr><tr><td><a href="/pages/zEZHvsoJqCTqjfnt1phB">Command</a></td><td align="center">"chance"</td><td align="center"><code>chance</code></td></tr><tr><td><a href="/pages/XXZetPPFRTkIo2PvaJUx">Drop</a></td><td align="center">-</td><td align="center"><code>amount</code></td></tr><tr><td><a href="/pages/XXZetPPFRTkIo2PvaJUx">Drop</a></td><td align="center">"radius"</td><td align="center"><code>radius</code></td></tr><tr><td><a href="/pages/XXZetPPFRTkIo2PvaJUx">Drop</a></td><td align="center">"chance"</td><td align="center"><code>chance</code></td></tr><tr><td><a href="/pages/g1kK94t20p9nbuUZ7ABh">Durability</a></td><td align="center">-</td><td align="center"><code>amount</code></td></tr><tr><td><a href="/pages/g1kK94t20p9nbuUZ7ABh">Durability</a></td><td align="center">"chance"</td><td align="center"><code>chance</code></td></tr><tr><td><a href="/pages/YB2XfHROn2YXrPcSxFv2">Effect</a></td><td align="center">"time"</td><td align="center"><code>time</code></td></tr><tr><td><a href="/pages/YB2XfHROn2YXrPcSxFv2">Effect</a></td><td align="center">"level"</td><td align="center"><code>level</code></td></tr><tr><td><a href="/pages/YB2XfHROn2YXrPcSxFv2">Effect</a></td><td align="center">"radius"</td><td align="center"> <code>radius</code></td></tr><tr><td><a href="/pages/YB2XfHROn2YXrPcSxFv2">Effect</a></td><td align="center">"chance"</td><td align="center"><code>chance</code></td></tr><tr><td><a href="/pages/a2OLyHCVWg1a3u6TWgeV">Energy</a></td><td align="center">-</td><td align="center"><code>amount</code></td></tr><tr><td><a href="/pages/a2OLyHCVWg1a3u6TWgeV">Energy</a></td><td align="center">"chance"</td><td align="center"><code>chance</code></td></tr><tr><td><a href="/pages/sq1nzlU6KI2w7huMjgjh">Energy per tick</a></td><td align="center">-</td><td align="center"><code>amount</code></td></tr><tr><td><a href="/pages/sq1nzlU6KI2w7huMjgjh">Energy per tick</a></td><td align="center">"chance"</td><td align="center"><code>chance</code></td></tr><tr><td><a href="/pages/oOyYTLDud5mge96UaaNN">Entity</a></td><td align="center">-</td><td align="center"><code>amount</code></td></tr><tr><td><a href="/pages/oOyYTLDud5mge96UaaNN">Entity</a></td><td align="center">"radius"</td><td align="center"><code>radius</code></td></tr><tr><td><a href="/pages/oOyYTLDud5mge96UaaNN">Entity</a></td><td align="center">"chance"</td><td align="center"><code>chance</code></td></tr><tr><td><a href="/pages/NqbcsbJHmLdUqrXRLly7">Fluid</a></td><td align="center">-</td><td align="center"><code>amount</code></td></tr><tr><td><a href="/pages/NqbcsbJHmLdUqrXRLly7">Fluid</a></td><td align="center">"chance"</td><td align="center"><code>chance</code></td></tr><tr><td><a href="/pages/Xzb1IFG4WMRZ6wauVunC">Fluid per tick</a></td><td align="center">-</td><td align="center"><code>amount</code></td></tr><tr><td><a href="/pages/Xzb1IFG4WMRZ6wauVunC">Fluid per tick</a></td><td align="center">"chance"</td><td align="center"><code>chance</code></td></tr><tr><td><a href="/pages/Ux71MzAwU8GTXEmaN1Be">Item</a></td><td align="center">-</td><td align="center"><code>amount</code></td></tr><tr><td><a href="/pages/Ux71MzAwU8GTXEmaN1Be">Item</a></td><td align="center">"chance"</td><td align="center"><code>chance</code></td></tr><tr><td><a href="/pages/03v5VVCQOHsAikggLGsv">Light</a></td><td align="center">-</td><td align="center"><code>light</code></td></tr><tr><td><a href="/pages/YhJk3RlcfZcbY8ELI5dR">Loot table</a></td><td align="center">"luck"</td><td align="center"><code>luck</code></td></tr><tr><td><a href="/pages/u9QYBIfyqYDY3FXOW1Ex">Redstone</a></td><td align="center">"power"</td><td align="center"><code>power</code></td></tr><tr><td>Speed</td><td align="center">-</td><td align="center">The recipe's <code>time</code> property</td></tr><tr><td>Function</td><td align="center">"chance"</td><td align="center"><code>chance</code></td></tr></tbody></table>

### Properties

The requirement modifier has 4 mandatory properties and 2 optional property.

#### Mandatory properties

<details>

<summary>Requirement</summary>

#### Name : `requirement`

#### Description :&#x20;

The type of the requirement you want to apply the modifier to. This is the same type as the one you specify in the `type` property when defining the requirement in the recipe json.

#### Example :&#x20;

```json
"requirement": "custommachinery:energy"
```

This modifier will be applied to the energy requirement.

#### Note :&#x20;

The recipe duration can also be modified with this system.&#x20;

Use `custommachinery:speed` to target it.

Warning : Using this as a requirement will alter the recipe process duration, which is the opposite of the speed (the lower the duration the faster the speed).

</details>

<details>

<summary>Mode</summary>

#### Name : `mode`

#### Description :&#x20;

The mode of the requirement you want to apply the modifier to. It can be either `input` or `output` but not both.

#### Example :&#x20;

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

This modifier will be applied only on input requirements.

</details>

<details>

<summary>Operation</summary>

#### Name : `operation`

#### Description :&#x20;

The mathematical operation that will be applied to the targeted requirement property by the modifier. The available operations are :

* `addition` : The resulting value will be the sum of the base requirement value and the modifier value.
* `multiplication` : The resulting value will be the multiplication of the base requirement value and the modifier value.

#### Example :&#x20;

```json
"operation": "multiplication"
```

The base requirement value (defined in the recipe) will be multiplicated by the value defined in this modifier.

</details>

<details>

<summary>Modifier</summary>

#### Name : `modifier`

#### Description :&#x20;

The value (double) to add or multiply to the base requirement value. It can be positive or negative and support decimal numbers.

#### Example :&#x20;

```json
"modifier": 0.5
```

</details>

#### Optional properties

<details>

<summary>Target</summary>

#### Name : `target`

#### Description :&#x20;

Some requirement have more than one value that can be modified.&#x20;

In that case the `target` property can be used to define which one of the requirement property you want to modify.&#x20;

For example some requirement have a `chance` property that can be modified by the upgrade, simply use `"target": "chance"` to target the chance property instead of the default one.

#### Default : `empty`&#x20;

The modifier will be applied to the default property of the defined requirement.

#### Example :&#x20;

In case of the [Entity Requirement](https://github.com/Frinn38/Custom-Machinery/wiki/Entity-Requirement) the default property is `amount` so if you want to modify the `radius` property you can do :&#x20;

```json
"target": "radius"
```

</details>

<details>

<summary>Chance</summary>

#### Name : `chance`

#### Description :&#x20;

The chance the modifier will be applied to the requirement, this have nothing to do with the `chance` property some requirement have and will be applied independently.&#x20;

This value must be between 0 and 1 where 0 is 0% chance to be applied and 1 is 100% chance.

#### Default : 1&#x20;

The modifier have 100% chance to be applied on the requirement.

#### Example :&#x20;

```json
"chance": 0.4
```

The modifier have 40% chance to be applied on the requirement.

</details>

### Example

A modifier that half the time needed to process a recipe :&#x20;

```json
{
    "requirement": "custommachinery:speed",
    "mode": "input",
    "operation": "multiplication",
    "modifier": 0.5
}
```

A modifier that double the energy per tick consumed by a recipe :&#x20;

```json
{
    "requirement": "custommachinery:energy_per_tick",
    "mode": "input",
    "operation": "multiplication",
    "modifier": 2.0
}
```

A modifier that has 50% chance to add 1 item produced by a recipe :&#x20;

```json
{
    "requirement": "custommachinery:item",
    "mode": "output",
    "operation": "addition",
    "modifier": 1,
    "chance": 0.5
}
```
