Damage Sensor¶
文档版本:1.21.50.25
Defines what events to call when this entity is damaged by specific entities or items.
架构¶
damage_sensor:
{
array "triggers" : opt
{
object "<any array element>" : opt
{
entity_damage_source "cause"
number "damage_modifier" : opt
number "damage_multiplier" : opt
boolean "deals_damage" : opt
string "deals_damage" : opt
trigger "on_damage"
sound_event "on_damage_sound_event"
}
}
object "triggers" : opt
{
}
}
triggers
:array- The list of triggers that fire when the environment conditions match the given filter criteria.
triggers
<any array element>
:object- List of triggers with the events to call when taking specific kinds of damage.
<any array element>
cause
:entity_damage_source- Type of damage that triggers the events.
damage_modifier
:number- A modifier that adds to/removes from the base damage from the damage cause. It does not reduce damage to less than 0.
damage_multiplier
:number- A multiplier that modifies the base damage from the damage cause. If deals_damage is true the multiplier can only reduce the damage the entity will take to a minimum of 1.
deals_damage
:boolean- If true, the damage dealt to the entity will take away health from it, set to false to make the entity ignore that damage.
deals_damage
:string- Defines how received damage affects the entity:
- 'yes', received damage is applied to the entity.
- 'no', received damage is not applied to the entity.
- 'no_but_side_effects_apply', received damage is not applied to the entity, but the side effects of the attack are. This means that the attacker's weapon loses durability, enchantment side effects are applied, and so on.
on_damage
:trigger- Specifies filters for entity definitions and events.
event
:string- The event to run when the conditions for this trigger are met.
filters
:filters- 一个过滤器组。The list of conditions for this trigger to execute.
target
:subject- The target of the event.
trigger:
array
{
object "<any array element>" : opt
{
string "event" : opt
filters "filters"
subject "target"
}
}
<any array element>
:object
<any array element>
on_damage_sound_event
:sound_event- Defines what sound to play, if any, when the on_damage filters are met.
triggers
:object- List of triggers with the events to call when taking specific kinds of damage.
triggers