EntityDamageEvent
Extends EntityEvent
Implements Cancellable
Called when an entity takes damage.
Constants
CAUSE_BLOCK_EXPLOSION
public const CAUSE_BLOCK_EXPLOSION = 9CAUSE_CONTACT
public const CAUSE_CONTACT = 0CAUSE_CUSTOM
public const CAUSE_CUSTOM = 14CAUSE_DROWNING
public const CAUSE_DROWNING = 8CAUSE_ENTITY_ATTACK
public const CAUSE_ENTITY_ATTACK = 1CAUSE_ENTITY_EXPLOSION
public const CAUSE_ENTITY_EXPLOSION = 10CAUSE_FALL
public const CAUSE_FALL = 4CAUSE_FALLING_BLOCK
public const CAUSE_FALLING_BLOCK = 16CAUSE_FIRE
public const CAUSE_FIRE = 5CAUSE_FIRE_TICK
public const CAUSE_FIRE_TICK = 6CAUSE_FLY_INTO_WALL 5.46.0
public const CAUSE_FLY_INTO_WALL = 17Flying into a wall while gliding with an elytra (kinetic energy).
CAUSE_FREEZE 5.46.0
public const CAUSE_FREEZE = 19Freezing in powder snow.
CAUSE_LAVA
public const CAUSE_LAVA = 7CAUSE_LIGHTNING 5.46.0
public const CAUSE_LIGHTNING = 18Struck by a lightning bolt.
CAUSE_MAGIC
public const CAUSE_MAGIC = 13CAUSE_PROJECTILE
public const CAUSE_PROJECTILE = 2CAUSE_STARVATION
public const CAUSE_STARVATION = 15CAUSE_SUFFOCATION
public const CAUSE_SUFFOCATION = 3CAUSE_SUICIDE
public const CAUSE_SUICIDE = 12CAUSE_VOID
public const CAUSE_VOID = 11MODIFIER_ABSORPTION
public const MODIFIER_ABSORPTION = 5MODIFIER_ARMOR
public const MODIFIER_ARMOR = 1MODIFIER_ARMOR_ENCHANTMENTS
public const MODIFIER_ARMOR_ENCHANTMENTS = 6MODIFIER_ARMOR_HELMET
public const MODIFIER_ARMOR_HELMET = 11MODIFIER_CRITICAL
public const MODIFIER_CRITICAL = 7MODIFIER_PREVIOUS_DAMAGE_COOLDOWN
public const MODIFIER_PREVIOUS_DAMAGE_COOLDOWN = 10MODIFIER_RESISTANCE
public const MODIFIER_RESISTANCE = 4MODIFIER_SMASH 5.46.0
public const MODIFIER_SMASH = 12Extra damage of a mace smash attack (fall distance and Density).
MODIFIER_STRENGTH
public const MODIFIER_STRENGTH = 2MODIFIER_TOTEM
public const MODIFIER_TOTEM = 8MODIFIER_WEAKNESS
public const MODIFIER_WEAKNESS = 3MODIFIER_WEAPON_ENCHANTMENTS
public const MODIFIER_WEAPON_ENCHANTMENTS = 9Methods
__construct()
public function __construct(\pocketmine\entity\Entity $entity, int $cause, float $damage, array $modifiers = [])canBeReducedByArmor()
public function canBeReducedByArmor() : boolReturns whether an entity can use armour points to reduce this type of damage.
getAttackCooldown()
public function getAttackCooldown() : intReturns the cooldown in ticks before the target entity can be attacked again.
getBaseDamage()
public function getBaseDamage() : floatReturns the base amount of damage applied, before modifiers.
getCause()
public function getCause() : intgetFinalDamage()
public function getFinalDamage() : floatgetModifier()
public function getModifier(int $type) : floatgetModifiers()
public function getModifiers() : arraygetOriginalBaseDamage()
public function getOriginalBaseDamage() : floatReturns the original base amount of damage applied, before alterations by plugins.
getOriginalModifier()
public function getOriginalModifier(int $type) : floatgetOriginalModifiers()
public function getOriginalModifiers() : arrayisApplicable()
public function isApplicable(int $type) : boolsetAttackCooldown()
public function setAttackCooldown(int $attackCooldown) : voidSets the cooldown in ticks before the target entity can be attacked again.
NOTE: This value is not used in non-Living entities
setBaseDamage()
public function setBaseDamage(float $damage) : voidSets the base amount of damage applied, optionally recalculating modifiers.
TODO: add ability to recalculate modifiers when this is set
setModifier()
public function setModifier(float $damage, int $type) : void