Wandering Trader

The wandering trader is a passive mob that randomly spawns near the player. It can trade, making natural items more available, less dangerous to obtain, and in some cases, renewable.

Spawning
The wandering trader appears randomly across the world with 2 leashed trader llamas. They will also try to spawn by a claimed bell in a village.

At any time, there can be only one wandering trader naturally spawned in loaded chunks. However, it is possible to have more than one wandering trader present by having one spawn in loaded chunks, while having another in unloaded chunks. After 24000 ticks (20 real-life minutes, or 1 Minecraft day) have passed since the world is created, the game attempts to spawn a wandering trader. If there are no wandering traders currently in any loaded chunks, the game tries to spawn a new wandering trader after every following 24000 ticks, within a 48-block radius of a player. The first spawn attempt has a 2.5% chance of success; if it fails, after another 24000 ticks another spawn attempt is made with a 5% chance of success. If that fails, for all subsequent spawn attempts the chance caps at 7.5%. On average, it takes 10.411 Minecraft days (or 3.5 real-life hours) for a wandering trader to spawn. After 48000 or 72000 ticks, the trader despawns, even when named, along with its trader llamas, resetting the cycle.

$$, when using spawn eggs or the command to spawn a wandering trader, llamas always spawn with it. Wandering traders never spawn if   is set to false.

$$, wandering traders never spawn if   is set to false.

When playing on a remote island, wandering traders usually spawn in the water. The game prefers spawning them on the world surface, but they also spawn underground if the player is sufficiently deep and the spawn volume is large enough.

Behavior
The wandering trader has 6 random trades. New trades are not unlocked after trading with it.

After spawning, the wandering trader has a managed schedule for 40–60 minutes. After the time expires, the wandering trader despawns, even if the wandering trader is named with a name tag or put in a vehicle such as a minecart or boat. A wandering trader despawns sooner if all trades have been locked. The trader may later respawn with new trades.

The wandering trader can sometimes form a caravan, due to wild llamas that follow the leashed trader llama(s).

Wandering traders drink a potion of invisibility during dusk. $$, they drink milk at dawn to remove the invisibility effect.

Wandering traders avoid zombies and their variants, all illager variants, and vexes, staying at least 8 blocks away. Unlike other villagers, a wandering trader killed by zombies does not become a zombie villager.

Wandering traders drink potions of invisibility if hurt by magic attacks or projectiles from hostile mobs, or when avoiding illagers, vexes, and zombies.

When attacked by a player, a wandering trader flees from the player as a villager would do. The llamas, however, attack the player by spitting if their master gets hit. The llamas stop attacking If the player is killed and respawns, if the llamas are leashed after the wandering trader is killed or if the player gets far enough away from them.

Like villagers, wandering traders can also close and open wooden doors.

Unlike most other villager-like mobs, wandering traders do not visually sit down when riding objects such as boats and minecarts.

Drops

 * a milk bucket (8.5% chance, increased 1% per level of Looting) if killed while holding or before finishing drinking.
 * a potion of invisibility (8.5% chance, increased 1% per level of Looting) if killed while holding or before finishing drinking.

A wandering trader also drops leads when killed or when separated too far from its trader llamas. The leads break and appear at the position of the llamas. The llamas also drop their leads when killed, and if a wandering trader and one of its llamas are riding the same boat, the lead breaks. This counts up to two leads.

Wandering traders do not reward any experience.

Trading
The trading system is a gameplay mechanic that allows players to buy items with emeralds.

A player can click on the wandering trader to view the items offered for sale. Different offers are visible in a list, and clicking on one of the offers moves the corresponding items to the slots above the player's inventory. All offers involve emeralds as a currency. A wandering trader has an emerald above its head while trading and typically sells items generated in the world or otherwise related to nature, such as plants, dyes, and buckets of fish. They can also trade less common items, such as coral or blue ice.

After the player purchases the same item several times, the wandering trader locks the trade, but unlike villagers, never unlocks the trade.

Unlike villagers, wandering traders only sell items, they do not buy items. Wandering traders do not have an experience bar and do not modify their offers or prices based on changing demand. This can be changed by the player by editing the corresponding NBT data flag through the use of the data command.

ID




Entity data
Wandering traders have entity data associated with them that contains various properties.

Trivia

 * The Wandering Trader was inspired by traveling merchants from various RPGs, specifically ones that appeared to provide players with healing items in dangerous places.
 * Villagers display their held items differently than most creatures do, using the "ground" parameter instead of the usual hand parameter in model display settings.