Skip to content

Provide Context

Invokes a condition with the provided context parameters.

Type ID: kaya:provide_context

Format

Field Type Default Description
condition Condition The condition to invoke.
parameters Context Parameter Map The context parameters to provide.

Example

{
    "type": "kaya:reference",
    "value": "example:item/is_armor_higher_than_threshold"/*(1)!*/,
    "parameters": {
        "example:item": {
            "type": "kaya:item",
            "value": "worn_item"
        },
        "example:threshold": {
            "type": "kaya:float",
            "value": 2.0
        }
    }
}
  1. The location of the file is data/example/kaya/condition/item/is_armor_higher_than_threshold.json with this as its contents:

    {
        "type": "kaya:compare",
        "comparison": {
            "type": "kaya:float",
            "comparator": ">",
            "first": {
                "type": "kaya:item/attribute",
                "attribute": "minecraft:armor",
                "item": "example:item"
            },
            "second": "example:threshold"
        }
    }
    

This example will invoke the example:item/is_armor_higher_than_threshold condition, provide the context parameters that it uses, and uses its result.

History

Minecraft Mod Changelog
1.21.5 0.1.0 Added the type.