Skip to content

Count in Area

Counts how many entities/blocks are within the specified area.

Type ID: kaya:count_in_area

Info

This type will provide the following context parameters to the condition field when counting targets depending on the area's specified target:

Parameter Description
kaya:entity_in_area The affected entity in the specified area.
Parameter Description
kaya:block_in_area The affected block in the specified area.

Format

Field Type Default Description
area Area The area to get the entities/blocks from.
condition Condition optional If specified, only count the entities/blocks that fulfill this condition.
limit Int Provider optional If specified, the counting will be ended early if the count reaches this value, unless it's 0 or a negative value.

Example

{
    "type": "kaya:count_in_area",
    "area": {
        "type": "kaya:box",
        "target": "entity",
        "shape": "star",
        "box": {
            "type": "kaya:inflate",
            "box": {
                "type": "kaya:entity/bounds",
                "entity": "this"
            },
            "vector": [
                2.0,
                0.0,
                2.0
            ]
        }
    },
    "condition": {
        "type": "kaya:check_entity_type",
        "key": "minecraft:creeper",
        "entity": "this"
    }
}

This example will count how many creepers are within the bounding box of the entity provided by the kaya:this_entity context parameter, inflated by 2 blocks in the horizontal directions.

History

Minecraft Mod Changelog
1.21.5 0.1.0 Added the type.