Wandering Merchants replaces the vanilla wandering trader with 4 new merchant types: farming, fishing, mining, and treasure. Each merchant has a different set of possible trades and has an equal chance of spawning.
Compatible with VanillaTweaks Wandering Trades datapack.
Farming Merchant Trades
This merchant deals with all things farming.
Trade 1
10 Sweet Berries -> 1 Emerald or
10 Dried Kelp Blocks -> 1 Emerald
Trade 2
5 Pumpkins -> 1 Emerald or
4 Melons -> 1 Emerald
Trade 3
1 Emerald -> 1 Allium
1 Emerald -> 1 Azure Bluet
1 Emerald -> 1 Blue Orchid
1 Emerald -> 1 Cornflower
1 Emerald -> 1 Dandelion
1 Emerald -> 1 Lily of the Valley
1 Emerald -> 1 Orange Tulip
1 Emerald -> 1 Oxeye Daisy
1 Emerald -> 1 Pink Tulip
1 Emerald -> 1 Poppy
1 Emerald -> 1 Red Tulip
1 Emerald -> 1 White Tulip
Trade 4
1 Emerald -> 3 Black Dye
1 Emerald -> 3 Blue Dye
1 Emerald -> 3 Brown Dye
1 Emerald -> 3 Cyan Dye
1 Emerald -> 3 Gray Dye
1 Emerald -> 3 Green Dye
1 Emerald -> 3 Light Blue Dye
1 Emerald -> 3 Light Gray Dye
1 Emerald -> 3 Lime Dye
1 Emerald -> 3 Magenta Dye
1 Emerald -> 3 Orange Dye
1 Emerald -> 3 Pink Dye
1 Emerald -> 3 Purple Dye
1 Emerald -> 3 Red Dye
1 Emerald -> 3 White Dye
1 Emerald -> 3 Yellow Dye
Trade 5
5 Emeralds -> 1 Acacia Sapling
5 Emeralds -> 1 Birch Sapling
5 Emeralds -> 1 Cherry Sapling
5 Emeralds -> 1 Dark Oak Sapling
5 Emeralds -> 1 Jungle Sapling
5 Emeralds -> 1 Oak Sapling
5 Emeralds -> 1 Spruce Sapling
5 Emeralds -> 1 Mangrove Propagule
Trade 6
2 Emerald -> 1 Spore Blossom
1 Emerald -> 2 Small Dripleaf
1 Emerald -> 1 Big Dripleaf
Fishing Merchant Trades
Trade 1
20 String -> 1 Emerald
5 Ink Sac -> 1 Emerald
5 Nautilus Shell -> 1 Emerald
Trade 2
15 Cod -> 1 Emerald
13 Salmon -> 1 Emerald
6 Tropical Fish -> 1 Emerald
4 Pufferfish -> 1 Emerald
Trade 3
2 Emerald -> 5 Glow Ink Sac
Trade 4
3 Emerald -> 1 Luck Potion (5:00)
Trade 5
2 Emerald -> 1 Sea Pickle
3 Emerald -> 1 Brain Coral Block
3 Emerald -> 1 Bubble Coral Block
3 Emerald -> 1 Fire Coral Block
3 Emerald -> 1 Horn Coral Block
3 Emerald -> 1 Tube Coral Block
Trade 6
8 Emerald -> 1 Pufferfish Bucket
8 Emerald -> Cod Bucket
Mining Merchant Trades
Trade 1
15 Coal -> 1 Emerald
22 Flint -> 1 Emerald
12 Quartz -> 1 Emerald
Trade 2
20 Stone -> 1 Emerald
16 Granite -> 1 Emerald
16 Andesite -> 1 Emerald
16 Granite -> 1 Emerald
Trade 3
1 Emerald -> 8 Sand
Trade 4
1 Emerald -> 4 Red Sand
Trade 5
1 Emerald -> 2 Pointed Dripstone
Trade 6
1 Emerald -> 1 Terracotta
Trade 7
1 Emerald -> 1 Calcite
Treasure Merchant Trades
Trade 1
4 Scute -> 1 Emerald
32 Rotten Flesh -> 1 Emerald
24 Feather -> 1 Emerald
Trade 2
5 Nautilus Shell -> 1 Emerald
22 Nether Wart -> 1 Emerald
24 Paper -> 1 Emerald
Trade 3
3 Emeralds -> 1 Experience Bottle
Trade 4
2 Emeralds -> 5 Glowstone
Trade 5
1 Emerald -> 1 Gunpowder
Trade 6
2 Emerald + 5 Arrow -> 5 Tipped Arrow
Configs Menu
Accessible with /function clgd.trader:config/menu
Used to configure values related to wandering trader spawn rates.
Planned features
Modding
Add your own trader variants
Modding
This section refers to features that are coming soon
The data format for a wandering trader variant is as follows: {Weight:1,Name:"",TradeTable:[]}
Weight
(optional) works as weight in a LootTable does, the higher the weight, the more likely that trader will be selected. If missing, the weight defaults to 1Name
will be used when announcing that the trader has spawned ("A {name} Has Spawned!").TradeTable
is a list of lists referring to each trade the merchant has. Each sub list is a list of possible trades for the wandering trader to have. The first sublist is a list of possible trades for the first trade slot, the second sublist for the second trade, and so on.
The trade format is as follows:{Weight:1,TradeData:{}}
Weight
(optional) works the same as mentioned earlierTradeData
(optional) contains the information for the trade to be added. This may be left blank if you want a chance of a trade not appearing.
The contents of TradeData
follow that of a typical villager trade, with buy
and sell
values, and and optional buyB
value:
buy:{id:"minecraft:emerald",Count:32},buyB:{id:"minecraft:book",Count:1},sell:{id:"minecraft:enchanted_book",Count:1,tag:{StoredEnchantments:{id:mending,lvl:1}}}}}
buy
stores the item being given in exchange for the item insell
buyB
(optional) is a second item to exchange. (This is used in librarian trades, Emeralds + Book = Enchanted Book).
The buy
, buyB
, and sell
tags each of 3 subtags:
id
- The string id of the itemCount
- (optional) the amount of the item. Probably defaults to 1tag
- (optional) NBT data on the item.
Tutorial: Adding your own merchant
This section refers to features that are coming soon
Although I tried my best to explain how modding works, it may still be confusing for some of you. This tutorial will take you though the step-by-step process of adding your own custom merchant.
For this tutorial, you must have basic knowledge on how do create a datapack. If you do not know how to create a datapack, you can find plenty online. TODO: find a good tutorial and link it here
First you want to create a new datapack with a new function. I'll call mine new_merchant.mcfunction
and put it in the namespace mypack
.
Inside the new_merchant.mcfunction
we need to initialize the trader and set its trades:
Creating the villager function
#This command does the initial setup for the merchant, assigning a name, weight, and setting up the tradetable
data modify storage clgd.trader:data NewMerchant append value {Weight:1,Name:"Special Merchant",TradeTable:[]}
# I recommend changing this value ^^^ to be something unique. If multiple packs use the same value, then there will be issues with one pack overwriting the other.
#This adds the first set of trade options to the tradetable
data modify storage clgd.trader:data NewMerchant.TradeTable append value []
#This adds a trade option to the first set of trades
data modify storage clgd.trader:data NewMerchant.TradeTable[-1] append value {TradeData:{buy:{id:"minecraft:coal",Count:48},sell:{id:"minecraft:diamond",Count:1}}}
#The 'data modify storage clgd.trader:data NewMerchant.TradeTable[-1]' means we are modifying the last set of trade options. Since there is only 1 right now, that means we are modifying the first one.
#This adds the second set of trade options to the tradetable
data modify storage clgd.trader:data NewMerchant.TradeTable append value []
#This adds a trade option to the second set of trades
data modify storage clgd.trader:data NewMerchant.TradeTable[-1] append value {TradeData:{buy:{id:"minecraft:diamond",Count:1},sell:{id:"minecraft:emerald",Count:2}}}
#Add a second trade option to the second set of trades
data modify storage clgd.trader:data NewMerchant.TradeTable[-1] append value {TradeData:{buy:{id:"minecraft:coal_block",Count:5},sell:{id:"minecraft:emerald",Count:2}}}
#Now that there are 2 trades, the 'data modify storage clgd.trader:data NewMerchant.TradeTable[-1]' refers to the second set of trades
This function will create the data for a new merchant with 2 trades. The first trade will always be 48 Coal -> 1 Diamond and the second trade will either be 1 Diamond -> 2 Emeralds or 5 Coal Blocks -> 1 Emerald
Running the function
Now that we've written the function to create the villager, we want to make sure that the function gets run to initialize the trades. This can be done by creating a new namespace called clgd.trader
then inside that namespace create a new folder called tags
, another subfolder called functions
, then a file called set_default_trades.json
. You'll also need to create another file called update_trades.json
So your folder structure should look like:
clgd.trader
-> tags
-> functions
-> set_default_trades.json
The set_default_trades.json
should look something like this
{
"values": [
"mypack:new_merchant"
]
}
External resources
Project members
CodingLegend0100
Owner