# Entity

Entity requirement is used to check, consume health or kill some entities in a specified radius of the machine.

To use it you need to provide the amount of entities/health you want to check/consume/kill and the radius the machine should search them.

Note that the larger the radius, the more lag it will generate, and the machine doesn't count entities in unloaded chunks.

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

The requirement type of entity requirement is : `"custommachinery:entity"`

### Properties

The entity requirement have 5 mandatory properties and 2 optional properties.

#### Mandatory properties

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

<details>

<summary>Mode</summary>

#### Name : `mode`

#### Description :

Define when the requirement will be processed.

* `input` The requirement will be processed at the start of the crafting process.
* `output` The requirement will be processed at the end of the crafting process.

#### Example :

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

The requirement will be processed at the start of the crafting process.

</details>

<details>

<summary>Action</summary>

#### Name : `action`

#### Description :&#x20;

Define what should the requirement check/do. The 4 available actions for entity requirement are :

* `check_amount` Will check the amount of entities in the specified radius and compare it to the specified amount.
* `check_health` Will check the sum of health of all nearby entities combined and compare it to the specified amount.
* `consume_health` Same than "check\_health" but will consume the amount of life points on start if mode = input or finish if mode = output.
* `kill` Same than "check\_amount" but will kill the amount of entities on start if mode = input or finish if mode = output.

#### Example :&#x20;

```json
"action": "kill"
```

The requirement will kill entities.

</details>

<details>

<summary>Amount</summary>

#### Name : `amount`

#### Description :&#x20;

The amount of entities/health to check/consume/kill, the recipe will start/end only if the found amount of entities/health in the specified radius is greater or equals to this amount.

#### Example :&#x20;

```json
"amount": 10
```

The machine will search for 10 entities or 10 health points depending of the specified action.

</details>

<details>

<summary>Radius</summary>

#### Name : `radius`

#### Description :&#x20;

The radius (in blocks) the machine will search entities in, this is a circle centered to the machine.

#### Example :&#x20;

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

The machine will search for entities in a radius of 10 blocks around it.

</details>

#### Optional properties

<details>

<summary>Filter</summary>

#### Name : `filter`

#### Description :&#x20;

A blacklist of entities to ignore for when checking.&#x20;

By default all entities are allowed for "check\_amount" and "kill" actions, even non-living ones like item frame or armor stand.&#x20;

For "check\_health" and "consume\_health" actions only living entities (all mobs/animals/player) are allowed.

#### Default : `empty`

No blacklist.

#### Example :&#x20;

```json
"filter": ["minecraft:sheep", "minecraft:cow"]
```

&#x20;Allow all entities but vanilla sheeps and cows.

</details>

<details>

<summary>Whitelist</summary>

#### Name : `whitelist`

#### Description :&#x20;

A boolean, if true the `filter` property will be a whitelist instead of a blacklist and only entities specified in the filter will be allowed.

#### Default : `false`

The filter property is a blacklist.

#### Example :&#x20;

```json
"whitelist": true
```

Turn the "filter" property to a whitelist.

</details>

### Example

An Entity Requirement that will make the recipe kill 10 villagers in a radius of 20 blocks at the end of the process :&#x20;

The 10 villagers are needed to be in radius during all the crafting process or the machine will error.

```json
{
    "type": "custommachinery:entity",
    "mode": "output",
    "amount": 10,
    "radius": 20,
    "action": "kill",
    "filter": ["minecraft:villager"],
    "whitelist": 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/entity.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.
