跳转至

Damage Sensor

文档版本:1.21.0.24

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
      trigger "on_damage"
      sound_event "on_damage_sound_event"
    }
  }
  object "triggers" : opt
  {
  }
}
triggersarray
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>
causeentity_damage_source
Type of damage that triggers the events.
entity_damage_source:
string
damage_modifiernumber
A modifier that adds to/removes from the base damage from the damage cause. It does not reduce damage to less than 0.
damage_multipliernumber
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_damageboolean
If true, the damage dealt to the entity will take away health from it, set to false to make the entity ignore that damage.
on_damagetrigger
Specifies filters for entity definitions and events.
trigger:
string
trigger:
{
  string "event" : opt
  filters "filters"
  subject "target"
}
eventstring
The event to run when the conditions for this trigger are met.
filtersfilters
一个过滤器组。The list of conditions for this trigger to execute.
targetsubject
The target of the event.
subject:
string
trigger:
array
{
  object "<any array element>" : opt
  {
    string "event" : opt
    filters "filters"
    subject "target"
  }
}
<any array element>object
<any array element>
on_damage_sound_eventsound_event
Defines what sound to play, if any, when the on_damage filters are met.
sound_event:
string
triggersobject
List of triggers with the events to call when taking specific kinds of damage.
triggers