# Effect

Effect requirement is used to make the custom machine give effects to entities.

This requirement doesn't have a mode and will never stop the processing of a recipe.

The effect can be given every tick or only at the end of the crafting process (see the `finish` property below).

The requirement type of effect requirement is : `"custommachinery:effect"`.

### Properties

The effect requirement have 4 mandatory properties and 3 optional properties.

#### Mandatory properties

```json
"type": "custommachinery:effect" //Mandatory to define an effect requirement.
```

<details>

<summary>Effect</summary>

#### Name : `effect`

#### Description :

An effect ID, it can be any registered effect modded or vanilla.\
The effect ID must be defined by `nemaspace:id` like `minecraft:levitation` for example.

#### Example :

```json
"effect": "minecraft:strength"
```

The requirement will apply a vanilla Strength effect.

</details>

<details>

<summary>Time</summary>

#### Name : `time`

#### Description :

A positive integer that define the duration in ticks of the effect.

#### Example :

```json
"time": 100
```

The effect duration will be 100 ticks -> 5 seconds.

</details>

<details>

<summary>Radius</summary>

#### Name : `radius`

#### Description :

A positive integer that define the radius around the machine where the effect will be applied.\
The radius is in block size and is a circle.

#### Example :

```json
"radius": 10
```

The effect will be applied in all entities within 10 blocks of the machine.

</details>

#### Optional properties

<details>

<summary>Level</summary>

#### Name : `level`

#### Description :

A positive integer that define level of the effect, vanilla hardcode the effect level limit at 255.

#### Default : 1

The effect will be applied at level 1.

#### Example :

```json
"level": 4
```

The effect will be applied at level 4.

</details>

<details>

<summary>Filter</summary>

#### Name : `filter`

#### Description :

An array of entity ID that can have the effect applied.\
Any registered entity ID can be used here and must be specified in the format `namespace:id` like `minecraft:zombie` for example.

#### Default : `empty`

Any entity can have the effect applied.

#### Example :

```json
"filter": ["minecraft:zombie", "minecraft:villager"]
```

The effect will only be given to vanilla zombies and villagers.\
The `[]` are not required if only one entity ID is specified.

</details>

<details>

<summary>Finish</summary>

#### Name : `finish`

#### Description :

A boolean, if true the effect will only be applied at the end of the crafting process, if false the effect will be applied each tick while the machine is running.

Default : `false`

The effect is applied each tick of the crafting process.

#### Example :

```json
"finish": true
```

The effect is applied only once, at the end of the crafting process.

</details>

### Example

An effect requirement that add a 10 seconds, level 2 absorption effect to all players (and only players) in an area of 50 blocks at the end of the recipe:

```json
{
    "type": "custommachinery:effect",
    "effect": "minecraft:absorption",
    "time": 200,
    "radius": 50,
    "level": 2,
    "filter": "minecraft:player",
    "finish": true
}
```


---

# 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.16/recipes/requirements/effect.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.
