Called when an entity takes damage from another entity.
Definition at line 33 of file EntityDamageByEntityEvent.php.
◆ __construct()
pocketmine\event\entity\EntityDamageByEntityEvent::__construct |
( |
Entity | $damager, |
|
|
Entity | $entity, |
|
|
int | $cause, |
|
|
float | $damage, |
|
|
array | $modifiers = [], |
|
|
private float | $knockBack = Living::DEFAULT_KNOCKBACK_FORCE, |
|
|
private float | $verticalKnockBackLimit = Living::DEFAULT_KNOCKBACK_VERTICAL_LIMIT ) |
◆ addAttackerModifiers()
pocketmine\event\entity\EntityDamageByEntityEvent::addAttackerModifiers |
( |
Entity | $damager | ) |
|
|
protected |
◆ call()
pocketmine\event\Event::call |
( |
| ) |
|
|
inherited |
Calls event handlers registered for this event.
- Exceptions
-
RuntimeException if event call recursion reaches the max depth limit
Definition at line 49 of file Event.php.
◆ canBeReducedByArmor()
pocketmine\event\entity\EntityDamageEvent::canBeReducedByArmor |
( |
| ) |
|
|
inherited |
Returns whether an entity can use armour points to reduce this type of damage.
Definition at line 154 of file EntityDamageEvent.php.
◆ getAttackCooldown()
pocketmine\event\entity\EntityDamageEvent::getAttackCooldown |
( |
| ) |
|
|
inherited |
Returns the cooldown in ticks before the target entity can be attacked again.
Definition at line 174 of file EntityDamageEvent.php.
◆ getBaseDamage()
pocketmine\event\entity\EntityDamageEvent::getBaseDamage |
( |
| ) |
|
|
inherited |
◆ getCause()
pocketmine\event\entity\EntityDamageEvent::getCause |
( |
| ) |
|
|
inherited |
◆ getDamager()
pocketmine\event\entity\EntityDamageByEntityEvent::getDamager |
( |
| ) |
|
◆ getEntity()
pocketmine\event\entity\EntityEvent::getEntity |
( |
| ) |
|
|
inherited |
◆ getEventName()
pocketmine\event\Event::getEventName |
( |
| ) |
|
|
finalinherited |
◆ getFinalDamage()
pocketmine\event\entity\EntityDamageEvent::getFinalDamage |
( |
| ) |
|
|
inherited |
◆ getKnockBack()
pocketmine\event\entity\EntityDamageByEntityEvent::getKnockBack |
( |
| ) |
|
Returns the force with which the victim will be knocked back from the attacking entity.
- See also
- Living::DEFAULT_KNOCKBACK_FORCE
Definition at line 78 of file EntityDamageByEntityEvent.php.
◆ getModifier()
pocketmine\event\entity\EntityDamageEvent::getModifier |
( |
int | $type | ) |
|
|
inherited |
◆ getModifiers()
pocketmine\event\entity\EntityDamageEvent::getModifiers |
( |
| ) |
|
|
inherited |
◆ getOriginalBaseDamage()
pocketmine\event\entity\EntityDamageEvent::getOriginalBaseDamage |
( |
| ) |
|
|
inherited |
Returns the original base amount of damage applied, before alterations by plugins.
Definition at line 113 of file EntityDamageEvent.php.
◆ getOriginalModifier()
pocketmine\event\entity\EntityDamageEvent::getOriginalModifier |
( |
int | $type | ) |
|
|
inherited |
◆ getOriginalModifiers()
pocketmine\event\entity\EntityDamageEvent::getOriginalModifiers |
( |
| ) |
|
|
inherited |
◆ getVerticalKnockBackLimit()
pocketmine\event\entity\EntityDamageByEntityEvent::getVerticalKnockBackLimit |
( |
| ) |
|
Returns the maximum upwards velocity the victim may have after being knocked back. This ensures that the victim doesn't fly up into the sky when high levels of knockback are applied.
- See also
- Living::DEFAULT_KNOCKBACK_VERTICAL_LIMIT
Definition at line 97 of file EntityDamageByEntityEvent.php.
◆ hasHandlers()
static pocketmine\event\Event::hasHandlers |
( |
| ) |
|
|
staticinherited |
Returns whether the current class context has any registered global handlers. This can be used in hot code paths to avoid unnecessary event object creation.
Usage: SomeEventClass::hasHandlers()
Definition at line 77 of file Event.php.
◆ isApplicable()
pocketmine\event\entity\EntityDamageEvent::isApplicable |
( |
int | $type | ) |
|
|
inherited |
◆ isCancelled()
pocketmine\event\Cancellable::isCancelled |
( |
| ) |
|
|
inherited |
Returns whether this instance of the event is currently cancelled.
If it is cancelled, only downstream handlers that declare @handleCancelled
will be called with this event.
◆ setAttackCooldown()
pocketmine\event\entity\EntityDamageEvent::setAttackCooldown |
( |
int | $attackCooldown | ) |
|
|
inherited |
Sets the cooldown in ticks before the target entity can be attacked again.
NOTE: This value is not used in non-Living entities
Definition at line 183 of file EntityDamageEvent.php.
◆ setBaseDamage()
pocketmine\event\entity\EntityDamageEvent::setBaseDamage |
( |
float | $damage | ) |
|
|
inherited |
Sets the base amount of damage applied, optionally recalculating modifiers.
TODO: add ability to recalculate modifiers when this is set
Definition at line 106 of file EntityDamageEvent.php.
◆ setKnockBack()
pocketmine\event\entity\EntityDamageByEntityEvent::setKnockBack |
( |
float | $knockBack | ) |
|
Sets the force with which the victim will be knocked back from the attacking entity. Larger values will knock the victim back further. Negative values will pull the victim towards the attacker.
Definition at line 87 of file EntityDamageByEntityEvent.php.
◆ setModifier()
pocketmine\event\entity\EntityDamageEvent::setModifier |
( |
float | $damage, |
|
|
int | $type ) |
|
inherited |
◆ setVerticalKnockBackLimit()
pocketmine\event\entity\EntityDamageByEntityEvent::setVerticalKnockBackLimit |
( |
float | $verticalKnockBackLimit | ) |
|
Sets the maximum upwards velocity the victim may have after being knocked back. Larger values will allow the victim to fly higher if the knockback force is also large.
Definition at line 105 of file EntityDamageByEntityEvent.php.
◆ $entity
Entity pocketmine\event\entity\EntityEvent::$entity |
|
protectedinherited |
@phpstan-var TEntity
Definition at line 37 of file EntityEvent.php.
Referenced by pocketmine\event\entity\EntityDamageByBlockEvent\__construct(), pocketmine\event\entity\EntityDamageByChildEntityEvent\__construct(), pocketmine\event\entity\EntityDamageByEntityEvent\__construct(), pocketmine\event\entity\EntityDamageEvent\__construct(), pocketmine\event\entity\EntityDeathEvent\__construct(), pocketmine\event\entity\EntityExplodeEvent\__construct(), pocketmine\event\player\PlayerDeathEvent\__construct(), pocketmine\event\entity\EntityDeathEvent\getEntity(), pocketmine\event\entity\EntityEvent\getEntity(), pocketmine\event\entity\EntityShootBowEvent\getEntity(), pocketmine\event\entity\ItemDespawnEvent\getEntity(), pocketmine\event\entity\ItemSpawnEvent\getEntity(), pocketmine\event\entity\ProjectileHitEvent\getEntity(), and pocketmine\event\entity\ProjectileLaunchEvent\getEntity().
◆ $eventName
string pocketmine\event\Event::$eventName = null |
|
protectedinherited |
◆ CAUSE_BLOCK_EXPLOSION
const pocketmine\event\entity\EntityDamageEvent::CAUSE_BLOCK_EXPLOSION = 9 |
|
inherited |
◆ CAUSE_CONTACT
const pocketmine\event\entity\EntityDamageEvent::CAUSE_CONTACT = 0 |
|
inherited |
◆ CAUSE_CUSTOM
const pocketmine\event\entity\EntityDamageEvent::CAUSE_CUSTOM = 14 |
|
inherited |
◆ CAUSE_DROWNING
const pocketmine\event\entity\EntityDamageEvent::CAUSE_DROWNING = 8 |
|
inherited |
◆ CAUSE_ENTITY_ATTACK
const pocketmine\event\entity\EntityDamageEvent::CAUSE_ENTITY_ATTACK = 1 |
|
inherited |
◆ CAUSE_ENTITY_EXPLOSION
const pocketmine\event\entity\EntityDamageEvent::CAUSE_ENTITY_EXPLOSION = 10 |
|
inherited |
◆ CAUSE_FALL
const pocketmine\event\entity\EntityDamageEvent::CAUSE_FALL = 4 |
|
inherited |
◆ CAUSE_FALLING_BLOCK
const pocketmine\event\entity\EntityDamageEvent::CAUSE_FALLING_BLOCK = 16 |
|
inherited |
◆ CAUSE_FIRE
const pocketmine\event\entity\EntityDamageEvent::CAUSE_FIRE = 5 |
|
inherited |
◆ CAUSE_FIRE_TICK
const pocketmine\event\entity\EntityDamageEvent::CAUSE_FIRE_TICK = 6 |
|
inherited |
◆ CAUSE_LAVA
const pocketmine\event\entity\EntityDamageEvent::CAUSE_LAVA = 7 |
|
inherited |
◆ CAUSE_MAGIC
const pocketmine\event\entity\EntityDamageEvent::CAUSE_MAGIC = 13 |
|
inherited |
◆ CAUSE_PROJECTILE
const pocketmine\event\entity\EntityDamageEvent::CAUSE_PROJECTILE = 2 |
|
inherited |
◆ CAUSE_STARVATION
const pocketmine\event\entity\EntityDamageEvent::CAUSE_STARVATION = 15 |
|
inherited |
◆ CAUSE_SUFFOCATION
const pocketmine\event\entity\EntityDamageEvent::CAUSE_SUFFOCATION = 3 |
|
inherited |
◆ CAUSE_SUICIDE
const pocketmine\event\entity\EntityDamageEvent::CAUSE_SUICIDE = 12 |
|
inherited |
◆ CAUSE_VOID
const pocketmine\event\entity\EntityDamageEvent::CAUSE_VOID = 11 |
|
inherited |
◆ MODIFIER_ABSORPTION
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_ABSORPTION = 5 |
|
inherited |
◆ MODIFIER_ARMOR
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_ARMOR = 1 |
|
inherited |
◆ MODIFIER_ARMOR_ENCHANTMENTS
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_ARMOR_ENCHANTMENTS = 6 |
|
inherited |
◆ MODIFIER_ARMOR_HELMET
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_ARMOR_HELMET = 11 |
|
inherited |
◆ MODIFIER_CRITICAL
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_CRITICAL = 7 |
|
inherited |
◆ MODIFIER_PREVIOUS_DAMAGE_COOLDOWN
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_PREVIOUS_DAMAGE_COOLDOWN = 10 |
|
inherited |
◆ MODIFIER_RESISTANCE
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_RESISTANCE = 4 |
|
inherited |
◆ MODIFIER_STRENGTH
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_STRENGTH = 2 |
|
inherited |
◆ MODIFIER_TOTEM
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_TOTEM = 8 |
|
inherited |
◆ MODIFIER_WEAKNESS
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_WEAKNESS = 3 |
|
inherited |
◆ MODIFIER_WEAPON_ENCHANTMENTS
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_WEAPON_ENCHANTMENTS = 9 |
|
inherited |
The documentation for this class was generated from the following file: