Prevent Use (Power Type)

Prevents the entity from being used, or from using others.

Blocks the right-click interaction between two entities. Which side is blocked is decided by target_used, and there are aliases so you do not have to think about it: apoli:prevent_entity_use stops the holder using other entities, apoli:prevent_being_used stops other entities using the holder.

Type ID: apoli:prevent_use (aliases apoli:prevent_entity_use, apoli:prevent_being_used)

Fields

FieldTypeDefaultDescription
handsarray of HandbothWhich hands are blocked — main_hand, off_hand, or both.
result_stackItem StackoptionalReplace the used stack with this when the use is blocked.
target_usedBooleanfalsefalse blocks the holder using others; true blocks others using the holder. Filled in by the aliases.
bientity_conditionBi-Entity ConditionoptionalOnly block for this pairing. The actor is the entity doing the interacting, the target is the one being interacted with — on both aliases.
item_conditionItem ConditionoptionalOnly block when the held item matches.
bientity_actionBi-Entity ActionoptionalRuns on the pair when a use is blocked.
held_item_actionItem ActionoptionalRuns on the held stack when a use is blocked.
result_item_actionItem ActionoptionalRuns on the stack the hand is holding after result_stack has been handed over.

The block is applied on both sides, so the client never plays the interaction it is about to lose. Actions run on the server only, once per interaction.

Examples

Nobody can put a lead on you, shear you or otherwise interact with you:

{
  "type": "apoli:prevent_being_used"
}

You cannot trade with villagers, but everything else still works:

{
  "type": "apoli:prevent_entity_use",
  "bientity_condition": {
    "type": "apoli:target_condition",
    "condition": { "type": "apoli:entity_type", "entity_type": "minecraft:villager" }
  }
}

Block only the off-hand, and only while holding something specific:

{
  "type": "apoli:prevent_entity_use",
  "hands": ["off_hand"],
  "item_condition": {
    "type": "apoli:ingredient",
    "ingredient": { "item": "minecraft:lead" }
  }
}