Skip to content

VillagerTrades 5.46.0 ​

final class · pocketmine\entity\npc\VillagerTrades · source

A small trade table per villager profession and for the wandering trader, picked from Mojang's behaviour pack (trading/economy_trades/*.json: quantities, trader experience and max uses). Only trades with plain items are included: enchanted books and gear, explorer maps, suspicious stew and dyed armour are left out. Each level gets up to two of its trades, chosen at random when the villager reaches the level, like vanilla.

Constants ​

TIER_EXP_REQUIREMENTS ​

php
public const TIER_EXP_REQUIREMENTS = [0, 10, 70, 150, 250]

Trader experience needed for each level (vanilla).

Methods ​

createOffers() ​

php
public static function createOffers(int $profession, int $tier) : array

Creates up to two random trades of the profession for the level, or none if the profession doesn't trade.

createWanderingTraderOffers() ​

php
public static function createWanderingTraderOffers() : array

Five common trades and one rare one, like the vanilla wandering trader.

getTradingProfessions() ​

php
public static function getTradingProfessions() : array

getUnknownItemNames() ​

php
public static function getUnknownItemNames() : array

Returns the item names of the tables that don't parse (for tests: every trade must be usable).

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