Skip to main content

Prevent Use (Power Type)

Blocks the right-click interaction between two entities. target_used decides which side is blocked, and two aliases fill it in for you: apoli:prevent_entity_use stops the entity with the power from using other entities, and apoli:prevent_being_used stops other entities from using it.

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

Fields

FieldTypeDefaultDescription
handsArray of HandbothThe hands that are blocked: main_hand, off_hand or both.
result_stackItem StackoptionalGiven to the actor when the use is blocked. It goes into the hand that was used if that hand is now empty, otherwise into the inventory, and it is dropped at the actor's feet if the inventory is full.
target_usedBooleanfalsefalse stops the entity with the power from using others, and true stops others from using it. The aliases fill this in.
bientity_conditionBi-Entity ConditionoptionalOnly block for this pairing. With either alias, the actor is the entity doing the interacting and the target is the one being interacted with.
item_conditionItem ConditionoptionalOnly block when the held item passes this condition.
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 result_stack before it is given to the actor. Without result_stack it does nothing, so to change the item in hand, use held_item_action.
note

The block applies on both sides, so the client never plays an interaction that is about to be refused. Actions run on the server only, once per interaction.

Examples

Nobody can put a lead on you, shear you or interact with you in any other way:

{
  "type": "apoli:prevent_being_used"
}

You can't 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 it holds a lead:

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