Action On Entity Use

Power Type

Executes an action when the player that has the power "uses" (right-clicks) an entity.

Type ID: origins:action_on_entity_use

Note

In the context of this power type, the 'actor' entity is the entity that has the power whilst the 'target' entity is the entity that was "used" (right-clicked).

Fields

Field Type Default Description
bientity_action Bi-entity Action Type optional If specified, this action will be executed on either or both the 'actor' and 'target' entities.
held_item_action Item Action Type optional If specified, this action will be executed on the item used by the 'actor' entity for right-clicking the 'target' entity.
result_item_action Item Action Type optional If specified, this action will be executed on the item that is given to the 'actor' entity.
bientity_condition Bi-entity Condition Type optional If specified, the specified actions will only be executed if this condition is fulfilled by either or both 'actor' and 'target' entities.
item_condition Item Condition Type optional If specified, the specified actions will only be executed if this condition is fulfilled by the item used by the 'actor' entity for right-clicking the 'target' entity.
hands Array of Strings ["off_hand" , "main_hand"] Determines if the power should be activated if the 'actor' entity used the specified hand(s). Accepts "off_hand", "main_hand" or both
result_stack Item Stack optional If specified, this item stack will be given to the 'actor' entity.
action_result Action Result "success" Determines the result of the 'use' action.
priority Integer 0 Determines the execution priority of the power.

Examples

{
    "type": "origins:action_on_entity_use",
    "bientity_action": {
        "type": "origins:target_action",
        "action": {
            "type": "origins:and",
            "actions": [
                {
                    "type": "origins:heal",
                    "amount": 2
                },
                {
                    "type": "origins:execute_command",
                    "command": "particle heart ~ ~0.5 ~ 0.3 0.3 0.3 0.009 4 normal @a"
                }
            ]
        }
    },
    "bientity_condition": {
        "type": "origins:owner"
    },
    "item_condition": {
        "type": "origins:empty"
    },
    "hands": [
        "main_hand"
    ],
    "condition": {
        "type": "origins:sneaking"
    }
}

This example will heal and display the heart particle effects at the tamed mob if the mob in question is owned by the player that has the power.

{
    "type": "origins:action_on_entity_use",
    "bientity_action": {
        "type": "origins:mount"
    },
    "bientity_condition": {
        "type": "origins:and",
        "conditions": [
            {
                "type": "origins:riding",
                "inverted": true
            },
            {
                "type": "origins:target_condition",
                "condition": {
                    "type": "origins:living"
                }
            }
        ]
    },
    "item_condition": {
        "type": "origins:empty"
    },
    "hands": [
        "main_hand"
    ],
    "condition": {
        "type": "origins:sneaking",
        "inverted": true
    }
}

This example will let the player ride any entity they "use" (right-click), with similar rules as to riding a Horse or a Pig.