PocketMine-MP 5.21.2 git-b2aa6396c3cc2cafdd815eacc360e1ad89599899
Loading...
Searching...
No Matches
pocketmine\event\entity\EntityDamageByEntityEvent Class Reference
+ Inheritance diagram for pocketmine\event\entity\EntityDamageByEntityEvent:
+ Collaboration diagram for pocketmine\event\entity\EntityDamageByEntityEvent:

Public Member Functions

 __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)
 
 call ()
 
 canBeReducedByArmor ()
 
 getAttackCooldown ()
 
 getBaseDamage ()
 
 getCause ()
 
 getDamager ()
 
 getEntity ()
 
 getEventName ()
 
 getFinalDamage ()
 
 getKnockBack ()
 
 getModifier (int $type)
 
 getModifiers ()
 
 getOriginalBaseDamage ()
 
 getOriginalModifier (int $type)
 
 getOriginalModifiers ()
 
 getVerticalKnockBackLimit ()
 
 isApplicable (int $type)
 
 isCancelled ()
 
 setAttackCooldown (int $attackCooldown)
 
 setBaseDamage (float $damage)
 
 setKnockBack (float $knockBack)
 
 setModifier (float $damage, int $type)
 
 setVerticalKnockBackLimit (float $verticalKnockBackLimit)
 

Static Public Member Functions

static hasHandlers ()
 

Public Attributes

const CAUSE_BLOCK_EXPLOSION = 9
 
const CAUSE_CONTACT = 0
 
const CAUSE_CUSTOM = 14
 
const CAUSE_DROWNING = 8
 
const CAUSE_ENTITY_ATTACK = 1
 
const CAUSE_ENTITY_EXPLOSION = 10
 
const CAUSE_FALL = 4
 
const CAUSE_FALLING_BLOCK = 16
 
const CAUSE_FIRE = 5
 
const CAUSE_FIRE_TICK = 6
 
const CAUSE_LAVA = 7
 
const CAUSE_MAGIC = 13
 
const CAUSE_PROJECTILE = 2
 
const CAUSE_STARVATION = 15
 
const CAUSE_SUFFOCATION = 3
 
const CAUSE_SUICIDE = 12
 
const CAUSE_VOID = 11
 
const MODIFIER_ABSORPTION = 5
 
const MODIFIER_ARMOR = 1
 
const MODIFIER_ARMOR_ENCHANTMENTS = 6
 
const MODIFIER_ARMOR_HELMET = 11
 
const MODIFIER_CRITICAL = 7
 
const MODIFIER_PREVIOUS_DAMAGE_COOLDOWN = 10
 
const MODIFIER_RESISTANCE = 4
 
const MODIFIER_STRENGTH = 2
 
const MODIFIER_TOTEM = 8
 
const MODIFIER_WEAKNESS = 3
 
const MODIFIER_WEAPON_ENCHANTMENTS = 9
 

Protected Member Functions

 addAttackerModifiers (Entity $damager)
 

Protected Attributes

Entity $entity
 
string $eventName = null
 

Detailed Description

Called when an entity takes damage from another entity.

Definition at line 33 of file EntityDamageByEntityEvent.php.

Constructor & Destructor Documentation

◆ __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 )
Parameters
float[]$modifiers

Definition at line 39 of file EntityDamageByEntityEvent.php.

References pocketmine\event\entity\EntityEvent\$entity.

Member Function Documentation

◆ addAttackerModifiers()

pocketmine\event\entity\EntityDamageByEntityEvent::addAttackerModifiers ( Entity $damager)
protected

Definition at line 53 of file EntityDamageByEntityEvent.php.

◆ 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

Returns the base amount of damage applied, before modifiers.

Definition at line 97 of file EntityDamageEvent.php.

Referenced by pocketmine\entity\Living\applyDamageModifiers().

+ Here is the caller graph for this function:

◆ getCause()

pocketmine\event\entity\EntityDamageEvent::getCause ( )
inherited

Definition at line 90 of file EntityDamageEvent.php.

◆ getDamager()

pocketmine\event\entity\EntityDamageByEntityEvent::getDamager ( )

Returns the attacking entity, or null if the attacker has been killed or closed.

Definition at line 69 of file EntityDamageByEntityEvent.php.

◆ getEntity()

◆ getEventName()

pocketmine\event\Event::getEventName ( )
finalinherited

Definition at line 40 of file Event.php.

◆ getFinalDamage()

pocketmine\event\entity\EntityDamageEvent::getFinalDamage ( )
inherited

Definition at line 147 of file EntityDamageEvent.php.

◆ 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

Definition at line 135 of file EntityDamageEvent.php.

◆ getModifiers()

pocketmine\event\entity\EntityDamageEvent::getModifiers ( )
inherited
Returns
float[]

Definition at line 131 of file EntityDamageEvent.php.

◆ 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

Definition at line 124 of file EntityDamageEvent.php.

◆ getOriginalModifiers()

pocketmine\event\entity\EntityDamageEvent::getOriginalModifiers ( )
inherited
Returns
float[]

Definition at line 120 of file EntityDamageEvent.php.

◆ 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

Definition at line 143 of file EntityDamageEvent.php.

◆ 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

Definition at line 139 of file EntityDamageEvent.php.

◆ 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.

Member Data Documentation

◆ $entity

◆ $eventName

string pocketmine\event\Event::$eventName = null
protectedinherited

Definition at line 38 of file Event.php.

◆ CAUSE_BLOCK_EXPLOSION

const pocketmine\event\entity\EntityDamageEvent::CAUSE_BLOCK_EXPLOSION = 9
inherited

Definition at line 60 of file EntityDamageEvent.php.

◆ CAUSE_CONTACT

const pocketmine\event\entity\EntityDamageEvent::CAUSE_CONTACT = 0
inherited

Definition at line 51 of file EntityDamageEvent.php.

◆ CAUSE_CUSTOM

const pocketmine\event\entity\EntityDamageEvent::CAUSE_CUSTOM = 14
inherited

Definition at line 65 of file EntityDamageEvent.php.

◆ CAUSE_DROWNING

const pocketmine\event\entity\EntityDamageEvent::CAUSE_DROWNING = 8
inherited

Definition at line 59 of file EntityDamageEvent.php.

◆ CAUSE_ENTITY_ATTACK

const pocketmine\event\entity\EntityDamageEvent::CAUSE_ENTITY_ATTACK = 1
inherited

Definition at line 52 of file EntityDamageEvent.php.

◆ CAUSE_ENTITY_EXPLOSION

const pocketmine\event\entity\EntityDamageEvent::CAUSE_ENTITY_EXPLOSION = 10
inherited

Definition at line 61 of file EntityDamageEvent.php.

◆ CAUSE_FALL

const pocketmine\event\entity\EntityDamageEvent::CAUSE_FALL = 4
inherited

Definition at line 55 of file EntityDamageEvent.php.

◆ CAUSE_FALLING_BLOCK

const pocketmine\event\entity\EntityDamageEvent::CAUSE_FALLING_BLOCK = 16
inherited

Definition at line 67 of file EntityDamageEvent.php.

◆ CAUSE_FIRE

const pocketmine\event\entity\EntityDamageEvent::CAUSE_FIRE = 5
inherited

Definition at line 56 of file EntityDamageEvent.php.

◆ CAUSE_FIRE_TICK

const pocketmine\event\entity\EntityDamageEvent::CAUSE_FIRE_TICK = 6
inherited

Definition at line 57 of file EntityDamageEvent.php.

◆ CAUSE_LAVA

const pocketmine\event\entity\EntityDamageEvent::CAUSE_LAVA = 7
inherited

Definition at line 58 of file EntityDamageEvent.php.

◆ CAUSE_MAGIC

const pocketmine\event\entity\EntityDamageEvent::CAUSE_MAGIC = 13
inherited

Definition at line 64 of file EntityDamageEvent.php.

◆ CAUSE_PROJECTILE

const pocketmine\event\entity\EntityDamageEvent::CAUSE_PROJECTILE = 2
inherited

Definition at line 53 of file EntityDamageEvent.php.

◆ CAUSE_STARVATION

const pocketmine\event\entity\EntityDamageEvent::CAUSE_STARVATION = 15
inherited

Definition at line 66 of file EntityDamageEvent.php.

◆ CAUSE_SUFFOCATION

const pocketmine\event\entity\EntityDamageEvent::CAUSE_SUFFOCATION = 3
inherited

Definition at line 54 of file EntityDamageEvent.php.

◆ CAUSE_SUICIDE

const pocketmine\event\entity\EntityDamageEvent::CAUSE_SUICIDE = 12
inherited

Definition at line 63 of file EntityDamageEvent.php.

◆ CAUSE_VOID

const pocketmine\event\entity\EntityDamageEvent::CAUSE_VOID = 11
inherited

Definition at line 62 of file EntityDamageEvent.php.

◆ MODIFIER_ABSORPTION

const pocketmine\event\entity\EntityDamageEvent::MODIFIER_ABSORPTION = 5
inherited

Definition at line 43 of file EntityDamageEvent.php.

◆ MODIFIER_ARMOR

const pocketmine\event\entity\EntityDamageEvent::MODIFIER_ARMOR = 1
inherited

Definition at line 39 of file EntityDamageEvent.php.

◆ MODIFIER_ARMOR_ENCHANTMENTS

const pocketmine\event\entity\EntityDamageEvent::MODIFIER_ARMOR_ENCHANTMENTS = 6
inherited

Definition at line 44 of file EntityDamageEvent.php.

◆ MODIFIER_ARMOR_HELMET

const pocketmine\event\entity\EntityDamageEvent::MODIFIER_ARMOR_HELMET = 11
inherited

Definition at line 49 of file EntityDamageEvent.php.

◆ MODIFIER_CRITICAL

const pocketmine\event\entity\EntityDamageEvent::MODIFIER_CRITICAL = 7
inherited

Definition at line 45 of file EntityDamageEvent.php.

◆ MODIFIER_PREVIOUS_DAMAGE_COOLDOWN

const pocketmine\event\entity\EntityDamageEvent::MODIFIER_PREVIOUS_DAMAGE_COOLDOWN = 10
inherited

Definition at line 48 of file EntityDamageEvent.php.

◆ MODIFIER_RESISTANCE

const pocketmine\event\entity\EntityDamageEvent::MODIFIER_RESISTANCE = 4
inherited

Definition at line 42 of file EntityDamageEvent.php.

◆ MODIFIER_STRENGTH

const pocketmine\event\entity\EntityDamageEvent::MODIFIER_STRENGTH = 2
inherited

Definition at line 40 of file EntityDamageEvent.php.

◆ MODIFIER_TOTEM

const pocketmine\event\entity\EntityDamageEvent::MODIFIER_TOTEM = 8
inherited

Definition at line 46 of file EntityDamageEvent.php.

◆ MODIFIER_WEAKNESS

const pocketmine\event\entity\EntityDamageEvent::MODIFIER_WEAKNESS = 3
inherited

Definition at line 41 of file EntityDamageEvent.php.

◆ MODIFIER_WEAPON_ENCHANTMENTS

const pocketmine\event\entity\EntityDamageEvent::MODIFIER_WEAPON_ENCHANTMENTS = 9
inherited

Definition at line 47 of file EntityDamageEvent.php.


The documentation for this class was generated from the following file: