类 LivingDamageEvent.Pre

封闭类:
LivingDamageEvent

public static class LivingDamageEvent.Pre extends LivingDamageEvent
LivingDamageEvent.Pre is fired when an Entity is set to be hurt.
At this point armor, and potion modifiers have already been applied to the damage value and the entity. Absorption modifiers are handled after this event.
This event is fired in LivingEntity#actuallyHurt(DamageSource, float
For custom posting of this event, the event expects to be fired after damage reductions have been calculated but before any changes to the entity health has been applied. This event expects a mutable DamageContainer.
This event is fired via the CommonHooks.onLivingDamagePre(LivingEntity, DamageContainer).
另请参阅:
  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • getContainer

      public DamageContainer getContainer()
      返回 the DamageContainer instance for this damage sequence。
      返回:
      the DamageContainer instance for this damage sequence
    • getSource

      public DamageSource getSource()
      返回 the damage source for this damage sequence。
      返回:
      the damage source for this damage sequence
    • getNewDamage

      public float getNewDamage()
      返回 the current value to be applied to the entity's health after this event。
      返回:
      the current value to be applied to the entity's health after this event
    • getOriginalDamage

      public float getOriginalDamage()
      返回 the original damage amount from the damage source。
      返回:
      the original damage amount from the damage source
    • setNewDamage

      public void setNewDamage(float newDamage)
      Sets the amount to reduce the entity health by
      参数:
      newDamage - the new damage value