Skip to content

TransactionBuilderInventory ​

final class · pocketmine\inventory\transaction\TransactionBuilderInventory · source

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() : array

getActualInventory() ​

php
public function getActualInventory() : \pocketmine\inventory\Inventory

getContents() ​

php
public function getContents(bool $includeEmpty = false) : array

getItem() ​

php
public function getItem(int $index) : \pocketmine\item\Item

getSize() ​

php
public function getSize() : int

internalSetContents() protected ​

php
protected function internalSetContents(array $items) : void

internalSetItem() protected ​

php
protected function internalSetItem(int $index, \pocketmine\item\Item $item) : void

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.