Skip to content

TradeInventory 5.46.0 ​

final class · pocketmine\inventory\TradeInventory · source

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 = 0

SLOT_BUY_B ​

php
public const SLOT_BUY_B = 1

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\npc\Trader $trader, \pocketmine\player\Player $player)

getOffer() ​

php
public function getOffer(int $networkId) : ?\pocketmine\entity\npc\TradeOffer

Returns 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\Player

getTrader() ​

php
public function getTrader() : \pocketmine\entity\npc\Trader

onClose() ​

php
public function onClose(\pocketmine\player\Player $who) : void

onOpen() ​

php
public function onOpen(\pocketmine\player\Player $who) : void

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