TransactionBuilderInventory
Extends BaseInventory
This class facilitates generating SlotChangeActions to build an inventory transaction. It wraps around the inventory you want to modify under transaction, and generates a diff of changes. This allows you to use the normal Inventory API methods like addItem() and so on to build a transaction, without modifying the original inventory.
Methods
__construct()
php
public function __construct(\pocketmine\inventory\Inventory $actualInventory)generateActions()
php
public function generateActions() : arraygetActualInventory()
php
public function getActualInventory() : \pocketmine\inventory\InventorygetContents()
php
public function getContents(bool $includeEmpty = false) : arraygetItem()
php
public function getItem(int $index) : \pocketmine\item\ItemgetSize()
php
public function getSize() : intinternalSetContents() protected
php
protected function internalSetContents(array $items) : voidinternalSetItem() protected
php
protected function internalSetItem(int $index, \pocketmine\item\Item $item) : void