TradeInventory 5.46.0
Extends SimpleInventory
Implements TemporaryInventory
The trading screen of a villager or wandering trader, opened for one player. Its two slots are the payment slots of the screen (UI slots 4 and 5, "trade2_ingredient"); items left there go back to the player when it's closed. Opening it sends the trades with UpdateTradePacket (see \pocketmine\network\mcpe\InventoryManager).
Constants
SLOT_BUY_A
php
public const SLOT_BUY_A = 0SLOT_BUY_B
php
public const SLOT_BUY_B = 1Methods
__construct()
php
public function __construct(\pocketmine\entity\npc\Trader $trader, \pocketmine\player\Player $player)getOffer()
php
public function getOffer(int $networkId) : ?\pocketmine\entity\npc\TradeOfferReturns the trade with the given network ID (the recipe ID of the client's CraftRecipe request), if the trader offers it.
getPlayer()
php
public function getPlayer() : \pocketmine\player\PlayergetTrader()
php
public function getTrader() : \pocketmine\entity\npc\TraderonClose()
php
public function onClose(\pocketmine\player\Player $who) : voidonOpen()
php
public function onOpen(\pocketmine\player\Player $who) : void