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

Public Member Functions

 __construct (private CraftingTransaction $transaction, private CraftingRecipe $recipe, private int $repetitions, private array $inputs, private array $outputs)
 
 call ()
 
 getEventName ()
 
 getInputs ()
 
 getOutputs ()
 
 getPlayer ()
 
 getRecipe ()
 
 getRepetitions ()
 
 getTransaction ()
 
 isCancelled ()
 

Static Public Member Functions

static hasHandlers ()
 

Protected Attributes

string $eventName = null
 

Detailed Description

Definition at line 35 of file CraftItemEvent.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\event\inventory\CraftItemEvent::__construct ( private CraftingTransaction $transaction,
private CraftingRecipe $recipe,
private int $repetitions,
private array $inputs,
private array $outputs )
Parameters
Item[]$inputs
Item[]$outputs

Definition at line 42 of file CraftItemEvent.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.

◆ getEventName()

pocketmine\event\Event::getEventName ( )
finalinherited

Definition at line 40 of file Event.php.

◆ getInputs()

pocketmine\event\inventory\CraftItemEvent::getInputs ( )

Returns a list of items destroyed as ingredients of the recipe.

Returns
Item[]

Definition at line 77 of file CraftItemEvent.php.

◆ getOutputs()

pocketmine\event\inventory\CraftItemEvent::getOutputs ( )

Returns a list of items created by crafting the recipe.

Returns
Item[]

Definition at line 86 of file CraftItemEvent.php.

◆ getPlayer()

pocketmine\event\inventory\CraftItemEvent::getPlayer ( )

Definition at line 90 of file CraftItemEvent.php.

◆ getRecipe()

pocketmine\event\inventory\CraftItemEvent::getRecipe ( )

Returns the recipe crafted.

Definition at line 60 of file CraftItemEvent.php.

◆ getRepetitions()

pocketmine\event\inventory\CraftItemEvent::getRepetitions ( )

Returns the number of times the recipe was crafted. This is usually 1, but might be more in the case of recipe book shift-clicks (which craft lots of items in a batch).

Definition at line 68 of file CraftItemEvent.php.

◆ getTransaction()

pocketmine\event\inventory\CraftItemEvent::getTransaction ( )

Returns the inventory transaction involved in this crafting event.

Definition at line 53 of file CraftItemEvent.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.

Member Data Documentation

◆ $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: