Interface EntityDamageEvent
- All Superinterfaces:
Cancellable, Event
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 TypeMethodDescriptionfloatdamage()Returns the damage about to be dealt, in half-hearts, before any reduction.damager()Returns the entity that caused the damage, ornullfor environmental damage.entity()Returns the entity about to be hurt.doubleReturns the horizontal knockback strength about to be applied.voidsetDamage(float damage) Changes the damage about to be dealt.voidsetKnockback(double knockback) Changes the knockback about to be applied.source()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
-
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;<= 0makes 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;0disables it- Since:
- 0.1.0
-