PocketMine-MP 5.15.1 git-5ef247620a7c6301a849b54e5ef1009217729fc8
pocketmine\event\entity\EntityItemPickupEvent Class Reference
+ Inheritance diagram for pocketmine\event\entity\EntityItemPickupEvent:
+ Collaboration diagram for pocketmine\event\entity\EntityItemPickupEvent:

Public Member Functions

 __construct (Entity $collector, private Entity $origin, private Item $item, private ?Inventory $inventory)
 
 call ()
 
 getEntity ()
 
 getEventName ()
 
 getInventory ()
 
 getItem ()
 
 getOrigin ()
 
 isCancelled ()
 
 setInventory (?Inventory $inventory)
 
 setItem (Item $item)
 

Static Public Member Functions

static hasHandlers ()
 

Protected Attributes

Entity $entity
 
string $eventName = null
 

Detailed Description

Called when an entity picks up an item, arrow, etc. @phpstan-extends EntityEvent<Entity>

Definition at line 36 of file EntityItemPickupEvent.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\event\entity\EntityItemPickupEvent::__construct ( Entity  $collector,
private Entity  $origin,
private Item  $item,
private ?Inventory  $inventory 
)

Definition at line 39 of file EntityItemPickupEvent.php.

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.

◆ getEntity()

◆ getEventName()

pocketmine\event\Event::getEventName ( )
finalinherited

Definition at line 40 of file Event.php.

◆ getInventory()

pocketmine\event\entity\EntityItemPickupEvent::getInventory ( )

Inventory to which received items will be added.

Definition at line 69 of file EntityItemPickupEvent.php.

◆ getItem()

pocketmine\event\entity\EntityItemPickupEvent::getItem ( )

Items to be received

Definition at line 55 of file EntityItemPickupEvent.php.

◆ getOrigin()

pocketmine\event\entity\EntityItemPickupEvent::getOrigin ( )

Definition at line 48 of file EntityItemPickupEvent.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.

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

◆ setInventory()

pocketmine\event\entity\EntityItemPickupEvent::setInventory ( ?Inventory  $inventory)

Change the inventory to which received items are added.

Definition at line 76 of file EntityItemPickupEvent.php.

◆ setItem()

pocketmine\event\entity\EntityItemPickupEvent::setItem ( Item  $item)

Change the items to receive.

Definition at line 62 of file EntityItemPickupEvent.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: