Skip to content

Entity Requirement

Frinn38 edited this page May 26, 2021 · 1 revision

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 : "type": "custommachinery:entity" Put this in the requirement json to define an Entity Requirement.

Properties

Beside the 2 common mandatory properties ("type" and "mode") the Entity Requirement have 3 other mandatory property and 2 optional property.

action (Mandatory)

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"

amount (Mandatory)

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 (Mandatory)

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.

filter (Optional)

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 (Optional)

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

Example : "whitelist": true Turn the "filter" property to a whitelist.

Example

An Entity Requirement that will make the recipe kill 10 villagers in a radius of 20 blocks at the end of the process (Note that 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
}
Clone this wiki locally