Skip to content

WanderingTrader 5.46.0 ​

class · pocketmine\entity\npc\WanderingTrader · source

Extends Mob
Implements Trader

Bedrock values (entities/wandering_trader.json): 20 health, 0.6x1.9, movement 0.5 (0.6x when strolling or panicking), runs from zombies and other monsters within 6 blocks. Sells five common and one rare trade picked from the vanilla list (trading/economy_trades/wandering_trader_trades.json, see VillagerTrades); it has no levels. Trader llamas within 16 blocks attack whoever hurts it. A trader spawned by the world (see \pocketmine\world\mobs\WanderingTraderSpawner) despawns after 2 or 3 days (48000 or 72000 ticks while loaded) once no player is within 24 blocks, even if named (Bedrock). Drinking potions/milk and llamas on leads are not implemented. No drops; no XP.

Constants ​

DESPAWN_PLAYER_DISTANCE ​

php
public const DESPAWN_PLAYER_DISTANCE = 24

It only despawns when no player is this close.

TAG_DESPAWN_DELAY ​

php
public const TAG_DESPAWN_DELAY = "DespawnDelay"

TAG_OFFERS ​

php
public const TAG_OFFERS = "Offers"

Methods ​

attack() ​

php
public function attack(\pocketmine\event\entity\EntityDamageEvent $source) : void

canTradeWith() ​

php
public function canTradeWith(\pocketmine\player\Player $player) : bool

entityBaseTick() protected ​

php
protected function entityBaseTick(int $tickDiff = 1) : bool

getDespawnDelay() ​

php
public function getDespawnDelay() : int

Ticks left before the trader despawns (it waits for players to leave), 0 if it never despawns.

getInitialSizeInfo() protected ​

php
protected function getInitialSizeInfo() : \pocketmine\entity\EntitySizeInfo

getName() ​

php
public function getName() : string

getNetworkTypeId() ​

php
public static function getNetworkTypeId() : string

getPlayerReputation() ​

php
public function getPlayerReputation(\pocketmine\player\Player $player) : int

getTierExpRequirements() ​

php
public function getTierExpRequirements() : array

getTradeDisplayName() ​

php
public function getTradeDisplayName() : string

getTradeOffers() ​

php
public function getTradeOffers() : array

getTradeTier() ​

php
public function getTradeTier() : int

getTradingPlayer() ​

php
public function getTradingPlayer() : ?\pocketmine\player\Player

initEntity() protected ​

php
protected function initEntity(\pocketmine\nbt\tag\CompoundTag $nbt) : void

onInteractWithItem() protected ​

php
protected function onInteractWithItem(\pocketmine\player\Player $player, \pocketmine\item\Item $item) : bool

onTrade() ​

php
public function onTrade(\pocketmine\player\Player $player, \pocketmine\entity\npc\TradeOffer $offer, int $times) : void

registerGoals() protected ​

php
protected function registerGoals() : void

saveNBT() ​

php
public function saveNBT() : \pocketmine\nbt\tag\CompoundTag

setDespawnDelay() ​

php
public function setDespawnDelay(int $ticks) : void

setTradingPlayer() ​

php
public function setTradingPlayer(?\pocketmine\player\Player $player) : void

syncNetworkData() protected ​

php
protected function syncNetworkData(\pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection $properties) : void

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