PocketMine-MP 5.15.1 git-be6754494fdbbb9dd57c058ba0e33a4a78c4581f
pocketmine\event\entity\EntityDeathEvent Class Reference
+ Inheritance diagram for pocketmine\event\entity\EntityDeathEvent:
+ Collaboration diagram for pocketmine\event\entity\EntityDeathEvent:

Public Member Functions

 __construct (Living $entity, private array $drops=[], private int $xp=0)
 
 call ()
 
 getDrops ()
 
 getEntity ()
 
 getEventName ()
 
 getXpDropAmount ()
 
 setDrops (array $drops)
 
 setXpDropAmount (int $xp)
 

Static Public Member Functions

static hasHandlers ()
 

Protected Attributes

Entity $entity
 
string $eventName = null
 

Detailed Description

@phpstan-extends EntityEvent<Living>

Definition at line 33 of file EntityDeathEvent.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\event\entity\EntityDeathEvent::__construct ( Living  $entity,
private array  $drops = [],
private int  $xp = 0 
)
Parameters
Item[]$drops

Definition at line 38 of file EntityDeathEvent.php.

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

Member Function Documentation

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

◆ getDrops()

pocketmine\event\entity\EntityDeathEvent::getDrops ( )
Returns
Item[]

Definition at line 56 of file EntityDeathEvent.php.

◆ getEntity()

pocketmine\event\entity\EntityDeathEvent::getEntity ( )
Returns
Living

Reimplemented from pocketmine\event\entity\EntityEvent.

Reimplemented in pocketmine\event\player\PlayerDeathEvent.

Definition at line 49 of file EntityDeathEvent.php.

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

◆ getEventName()

pocketmine\event\Event::getEventName ( )
finalinherited

Definition at line 40 of file Event.php.

◆ getXpDropAmount()

pocketmine\event\entity\EntityDeathEvent::getXpDropAmount ( )

Returns how much experience is dropped due to this entity's death.

Definition at line 71 of file EntityDeathEvent.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.

◆ setDrops()

pocketmine\event\entity\EntityDeathEvent::setDrops ( array  $drops)
Parameters
Item[]$drops

Definition at line 63 of file EntityDeathEvent.php.

◆ setXpDropAmount()

pocketmine\event\entity\EntityDeathEvent::setXpDropAmount ( int  $xp)
Exceptions

InvalidArgumentException

Definition at line 78 of file EntityDeathEvent.php.

Member Data Documentation

◆ $entity

◆ $eventName

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

Definition at line 38 of file Event.php.


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