Entity

Make the recipe check, heal, hurt or kill entities near the machine

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 has 5 mandatory properties and 3 optional properties.

Mandatory properties

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

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 :

"mode": "input"

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

Action

Name : action

Description :

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 :

"action": "kill"

The requirement will kill entities.

Amount

Name : amount

Description :

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 :

"amount": 10

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

Radius

Name : radius

Description :

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

Example :

"radius": 10

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

Optional properties

Filter

Name : filter

Description :

A blacklist of entities to ignore for when checking.

By default all entities are allowed for "check_amount" and "kill" actions, even non-living ones like item frame or armor stand.

For "check_health" and "consume_health" actions only living entities (all mobs/animals/player) are allowed.

Default : empty

No blacklist.

Example :

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

Allow all entities but vanilla sheeps and cows.

Whitelist

Name : whitelist

Description :

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 :

"whitelist": true

Turn the "filter" property to a whitelist.

Delay

Name : delay

Description :

A double value, between 0.0 and 1.0 that represents at which time of the recipe the requirement action must be executed. A delay of 0.5 represent half of the recipe, 0.25 a quarter etc...

Default : 0

The requirement action will be executed on start if mode is input or on end if mode is output.

Example :

"delay": 0.33

The requirement action will be executed when the recipe progress time is at (approximatively) a third of the recipe total duration.

Note :

If delay is specified the requirement will be only executed at the specified delay, independently of the mode property. This property have no effect if the action is set to check as this action is executed each tick of the recipe.

Chance

Name : chance

Description :

A double between 0.0 and 1.0 that define the chance of the command to be run.

Default : 1

The command will always be run.

Example :

"chance": 0.7

The command will have 70% chance to be run.

Example

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

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

{
    "type": "custommachinery:entity",
    "mode": "output",
    "amount": 10,
    "radius": 20,
    "action": "kill",
    "filter": ["minecraft:villager"],
    "whitelist": true
}

Last updated