Interface EntityDamageEvent

All Superinterfaces:
Cancellable, Event

public interface EntityDamageEvent extends Event, Cancellable
Fired before an entity takes damage, once invulnerability frames have been cleared but before the shield, armor, Resistance, enchantments, absorption and knockback are applied.
Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Returns the damage about to be dealt, in half-hearts, before any reduction.
    Returns the entity that caused the damage, or null for environmental damage.
    Returns the entity about to be hurt.
    double
    Returns the horizontal knockback strength about to be applied.
    void
    setDamage(float damage)
    Changes the damage about to be dealt.
    void
    setKnockback(double knockback)
    Changes the knockback about to be applied.
    Returns the origin of the hit, carrying the damage type and the entities involved.

    Methods inherited from interface Cancellable

    isCancelled, setCancelled
  • Method Details

    • entity

      LivingEntity entity()
      Returns the entity about to be hurt.
      Returns:
      the entity about to be hurt
      Since:
      0.1.0
    • source

      DamageSource source()
      Returns the origin of the hit, carrying the damage type and the entities involved.
      Returns:
      the origin of the hit, carrying the damage type and the entities involved
      Since:
      0.1.0
    • damager

      @Nullable Entity damager()
      Returns the entity that caused the damage, or null for environmental damage.
      Returns:
      the entity that caused the damage, or null for environmental damage
      Since:
      0.1.0
    • damage

      float damage()
      Returns the damage about to be dealt, in half-hearts, before any reduction.
      Returns:
      the damage about to be dealt, in half-hearts, before any reduction
      Since:
      0.1.0
    • setDamage

      void setDamage(float damage)
      Changes the damage about to be dealt.
      Parameters:
      damage - the damage to deal instead; <= 0 makes the hit harmless
      Since:
      0.1.0
    • knockback

      double knockback()
      Returns the horizontal knockback strength about to be applied.
      Returns:
      the horizontal knockback strength about to be applied
      Since:
      0.1.0
    • setKnockback

      void setKnockback(double knockback)
      Changes the knockback about to be applied.
      Parameters:
      knockback - the knockback strength to apply instead; 0 disables it
      Since:
      0.1.0