Holder Condition (Item Condition Type)
Tests an entity condition against whoever is holding the stack. It fails when nothing is holding it, since an item on the ground or in a chest has no holder.
It connects an item context back to an entity, which lets an item condition depend on the person instead of the item.
Type ID: apoli:holder_condition (aliases apoli:holder and shappoli:holder_condition)
Fields
| Field | Type | Default | Description |
|---|---|---|---|
entity_condition | Entity Condition Type | required | The condition to test against the holder. condition is accepted as a legacy spelling. |
Example
A cursed sword that only bites for people who aren't sneaking. Any sword gets three extra levels of Sharpness through apoli:modify_enchantment_level, but only while its holder stands up straight:
{
"type": "apoli:modify_enchantment_level",
"enchantment": "minecraft:sharpness",
"item_condition": {
"type": "apoli:all_of",
"conditions": [
{ "type": "apoli:ingredient", "ingredient": { "tag": "minecraft:swords" } },
{
"type": "apoli:holder_condition",
"entity_condition": {
"type": "apoli:sneaking",
"inverted": true
}
}
]
},
"modifier": { "operation": "add_base_early", "value": 3 }
}Or make an item's use depend on the holder's resource:
{
"type": "apoli:prevent_item_use",
"item_condition": {
"type": "apoli:holder_condition",
"entity_condition": {
"type": "apoli:resource",
"resource": "vampire:blood",
"comparison": "<=",
"compare_to": 0
}
}
}