Action When Hit

Power Type

Executes an action if the entity that has the power has been hit by another entity.

Type ID: origins:action_when_hit

Note

In the context of this power type, the 'actor' entity is the entity that did the attacking whilst the 'target' entity is the entity that has the power.

Fields

Field Type Default Description
bientity_action Bi-entity Action Type The action to be executed on either or both the 'actor' and 'target' entities.
bientity_condition Bi-entity Condition Type optional If specified, the specified action will only be executed if this condition is fulfilled by either or both 'actor' and 'target' entities.
damage_condition Damage Condition Type optional If specified, the specified action will only be executed if this condition is fulfilled by the damage dealt by the 'actor' entity.
cooldown Integer 1 Interval of ticks this power needs to recharge before the power can be triggered again.
hud_render Hud Render {"should_render": false} Determines how the cooldown of this power is visualized on the HUD.

Examples

{
    "type": "origins:action_when_hit",
    "bientity_action": {
        "type": "origins:invert",
        "action": {
            "type": "origins:damage",
            "amount": 2,
            "damage_type": "minecraft:thorns"
        }
    }
}

This example will deal 1 heart of damage to any entities that attacks the entity that has the power, quite similar to having an armor item that has the Thorns enchantment. Bear in mind that the 'actor' is the entity that dealt the hit, so an invert is needed.