Class EntityDamageEvent
java.lang.Object
fr.fidorial.event.entity.EntityDamageEvent
- All Implemented Interfaces:
Cancellable, Event
Fired before an entity takes damage, once invulnerability frames have been cleared but before
armor, absorption and knockback are applied.
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionEntityDamageEvent(LivingEntity entity, DamageSource source, float damage, double knockback) -
Method Summary
Modifier and TypeMethodDescriptionfloatdamage()damager()entity()booleandoublevoidsetCancelled(boolean cancelled) voidsetDamage(float damage) voidsetKnockback(double knockback) source()
-
Constructor Details
-
EntityDamageEvent
-
-
Method Details
-
entity
-
source
- Returns:
- the origin of the hit, carrying the damage type and the entities involved
-
damager
-
damage
public float damage()- Returns:
- the damage about to be dealt, in half-hearts, before armor and absorption
-
setDamage
public void setDamage(float damage) - Parameters:
damage- the damage to deal instead;<= 0makes the hit harmless
-
knockback
public double knockback()- Returns:
- the horizontal knockback strength about to be applied
-
setKnockback
public void setKnockback(double knockback) - Parameters:
knockback- the knockback strength to apply instead;0disables it
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceCancellable
-
setCancelled
public void setCancelled(boolean cancelled) - Specified by:
setCancelledin interfaceCancellable
-