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
    • newDamage

      private final float newDamage
    • 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 LivingEntity.hurt(net.minecraft.world.damagesource.DamageSource, float) was invoked
    • getSource

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

      public float getNewDamage()
      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.