Skip to content

Active Item

Provismet edited this page Jun 20, 2023 · 3 revisions

Power Type

Uses and optionally consumes a held item to execute an action. The item may be held in either hand.

Type ID: proviorigins:active_item

Note
Multiple instances of this power may be placed onto the same entity, when the power is activated it will check for other instances and suppress itself based on hand priority and activation key. e.g. If both mainhand and offhand items are used in different instances of this power and both instances of the power use the same key then only the mainhand instance will activate.

Fields

Field Type Default Description
entity_action Entity Action Type The action to execute on the entity with this power.
item_condition Item Condition Type Optional The held item will only be accepted if this condition is fulfilled.
consume_condition Entity Condition Type Optional If this condition is absent or otherwise evalutates to true, then the held item in the corresponding hand will be consumed if the power successfully activates.
consume_amount Integer 1 The amount of items to remove from the item stack on a successful activation.
swing_arm Boolean true Whether or not the arm should swing on a successful activation.
cooldown Integer 1 The cooldown between uses of this instance of the power.
hud_render Hud Render {"should_render": false} Determines how the cooldown of this power is visualized on the HUD. (Identical to Active Self)
key Key {"key": "key.origins.primary_active"} What key this power should respond to.

Examples

{
    "type": "proviorigins:active_item",
    "entity_action": {
        "type": "origins:explode",
        "power": 5,
        "destruction_type": "none",
        "damage_self": true,
        "create_fire": false
    },
    "item_condition": {
        "type": "origins:ingredient",
        "ingredient": {
            "item": "minecraft:tnt"
        }
    }
}

This example will explode the player if the press the primary power key whilst holding TNT.