Class LivingDamageEvent.Post

Enclosing class:
LivingDamageEvent

public static class LivingDamageEvent.Post extends LivingDamageEvent
LivingDamageEvent.Post is fired after health is modified on the entity.
The fields in this event represent the FINAL values of what was applied to the entity.
Also note that appropriate resources (like armor durability and absorption extra hearts) have already been consumed.
This event is fired whenever an Entity is damaged in LivingEntity#actuallyHurt(DamageSource, float)
This event is fired via CommonHooks.onLivingDamagePost(LivingEntity, DamageContainer).
See Also:
  • Field Details

    • originalDamage

      private final float originalDamage
    • source

      private final DamageSource source
    • inflictedDamage

      private final float inflictedDamage
    • healthDamage

      private final float healthDamage
    • blockedDamage

      private final float blockedDamage
    • shieldDamage

      private final float shieldDamage
    • postAttackInvulnerabilityTicks

      private final int postAttackInvulnerabilityTicks
    • reductions

      private final EnumMap<DamageContainer.Reduction, Float> reductions
  • Constructor Details

  • Method Details

    • getOriginalDamage

      public float getOriginalDamage()
      Returns the original damage when Entity.hurt(DamageSource, float) was invoked.
      Returns:
      the original damage when Entity.hurt(DamageSource, float) was invoked
    • getSource

      public DamageSource getSource()
      Returns the DamageSource for this damage sequence.
      Returns:
      the DamageSource for this damage sequence
    • getInflictedDamage

      public float getInflictedDamage()
      Returns the amount of damage inflicted to the entity, after all modifications.
      Returns:
      the amount of damage inflicted to the entity, after all modifications
    • getHealthDamage

      public float getHealthDamage()
      Returns the amount of health this entity lost during this sequence.
      Returns:
      the amount of health this entity lost during this sequence
    • getBlockedDamage

      public float getBlockedDamage()
      Returns the amount of damage reduced by a blocking action.
      Returns:
      the amount of damage reduced by a blocking action
    • getShieldDamage

      public float getShieldDamage()
      Returns the amount of shield durability this entity lost if a blocking action was captured and the entity was holding a shield.
      Returns:
      the amount of shield durability this entity lost if a blocking action was captured and the entity was holding a shield
    • getPostAttackInvulnerabilityTicks

      public int getPostAttackInvulnerabilityTicks()
      Returns the number of ticks this entity will be invulnerable after this sequence.
      Returns:
      the number of ticks this entity will be invulnerable after this sequence
    • getReduction

      public float getReduction(DamageContainer.Reduction reduction)
      Parameters:
      reduction - the type of reduction to obtain
      Returns:
      the amount of damage reduced by this reduction type.