流浪商人将原版流浪商人替换为 4 种新的商人类型:农夫、渔夫、矿工和寻宝者。每位商人拥有不同的交易列表,且生成几率相等。
兼容 VanillaTweaks Wandering Trades 数据包。
农夫商人交易
这位商人专门处理与农业相关的所有事务。
交易 1
10 甜浆果 -> 1 绿宝石 或
10 干海带块 -> 1 绿宝石
交易 2
5 南瓜 -> 1 绿宝石 或
4 西瓜 -> 1 绿宝石
交易 3
1 绿宝石 -> 1 虞美人
1 绿宝石 -> 1 蓝花
1 绿宝石 -> 1 兰花
1 绿宝石 -> 1 矢车菊
1 绿宝石 -> 1 蒲公英
1 绿宝石 -> 1 山谷百合
1 绿宝石 -> 1 橙色郁金香
1 绿宝石 -> 1 雏菊
1 绿宝石 -> 1 粉色郁金香
1 绿宝石 -> 1 罂粟
1 绿宝石 -> 1 红色郁金香
1 绿宝石 -> 1 白色郁金香
交易 4
1 绿宝石 -> 3 黑色染料
1 绿宝石 -> 3 蓝色染料
1 绿宝石 -> 3 棕色染料
1 绿宝石 -> 3 青色染料
1 绿宝石 -> 3 灰色染料
1 绿宝石 -> 3 绿色染料
1 绿宝石 -> 3 亮蓝色染料
1 绿宝石 -> 3 亮灰色染料
1 绿宝石 -> 3 黄绿色染料
1 绿宝石 -> 3 品红色染料
1 绿宝石 -> 3 橙色染料
1 绿宝石 -> 3 粉红色染料
1 绿宝石 -> 3 紫色染料
1 绿宝石 -> 3 红色染料
1 绿宝石 -> 3 白色染料
1 绿宝石 -> 3 黄色染料
交易 5
5 绿宝石 -> 1 金合欢树苗
5 绿宝石 -> 1 白桦树苗
5 绿宝石 -> 1 樱桃树苗
5 绿宝石 -> 1 深色橡木树苗
5 绿宝石 -> 1 丛林树苗
5 绿宝石 -> 1 橡树树苗
5 绿宝石 -> 1 云杉树苗
5 绿宝石 -> 1 红树林气根
交易 6
2 绿宝石 -> 1 孢子花
1 绿宝石 -> 2 小型垂滴叶
1 绿宝石 -> 1 大型垂滴叶
渔夫商人交易
交易 1
20 线 -> 1 绿宝石
5 墨囊 -> 1 绿宝石
5 鹦鹉螺壳 -> 1 绿宝石
交易 2
15 鳕鱼 -> 1 绿宝石
13 鲑鱼 -> 1 绿宝石
6 热带鱼 -> 1 绿宝石
4 河豚 -> 1 绿宝石
交易 3
2 绿宝石 -> 5 发光墨囊
交易 4
3 绿宝石 -> 1 幸运药水 (5:00)
交易 5
2 绿宝石 -> 1 海泡菜
3 绿宝石 -> 1 脑珊瑚块
3 绿宝石 -> 1 气泡珊瑚块
3 绿宝石 -> 1 火珊瑚块
3 绿宝石 -> 1 角珊瑚块
3 绿宝石 -> 1 管珊瑚块
交易 6
8 绿宝石 -> 1 桶装河豚
8 绿宝石 -> 1 桶装鳕鱼
矿工商人交易
交易 1
15 煤炭 -> 1 绿宝石
22 燧石 -> 1 绿宝石
12 石英 -> 1 绿宝石
交易 2
20 石头 -> 1 绿宝石
16 花岗岩 -> 1 绿宝石
16 安山岩 -> 1 绿宝石
16 花岗岩 -> 1 绿宝石
交易 3
1 绿宝石 -> 8 沙子
交易 4
1 绿宝石 -> 4 红沙
交易 5
1 绿宝石 -> 2 钟乳石
交易 6
1 绿宝石 -> 1 陶瓦
交易 7
1 绿宝石 -> 1 方解石
寻宝商人交易
交易 1
4 龟壳 -> 1 绿宝石
32 腐肉 -> 1 绿宝石
24 羽毛 -> 1 绿宝石
交易 2
5 鹦鹉螺壳 -> 1 绿宝石
22 下界疣 -> 1 绿宝石
24 纸 -> 1 绿宝石
交易 3
3 绿宝石 -> 1 经验瓶
交易 4
2 绿宝石 -> 5 萤石粉
交易 5
1 绿宝石 -> 1 火药
交易 6
2 绿宝石 + 5 箭 -> 5 附魔箭
配置菜单
通过 /function clgd.trader:config/menu 访问
用于配置与流浪商人生成率相关的数值。
计划中的功能
模组开发
添加您自己的商人变体
模组开发
本节内容指代 即将推出 的功能
流浪商人变体的数据格式如下:{Weight:1,Name:"",TradeTable:[]}
Weight(可选)的作用类似于 LootTable 中的权重,权重越高,该商人被选中的可能性越大。如果缺失,权重默认为 1
Name 将在宣布商人已生成时使用(“一位 {name} 已生成!”)。
TradeTable 是一个列表的列表,指代商人拥有的每项交易。每个子列表是流浪商人可能拥有的交易列表。第一个子列表是第一项交易的候选列表,第二个子列表是第二项交易,依此类推。
交易格式如下:{Weight:1,TradeData:{}}
Weight(可选)作用同上所述
TradeData(可选)包含要添加的交易信息。如果您希望交易有不出现的几率,可以将其留空。
TradeData 的内容遵循典型的村民交易格式,包含 buy 和 sell 值,以及可选的 buyB 值:
`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 存储用于交换 sell 中物品的物品
buyB(可选)是第二种交换物品。(这用于图书管理员交易,绿宝石 + 书 = 附魔书)。
buy、buyB 和 sell 标签各自包含 3 个子标签:
id - 物品的字符串 ID
Count -(可选)物品的数量。通常默认为 1
tag -(可选)物品的 NBT 数据。
教程:添加您自己的商人
本节内容指代 即将推出 的功能
尽管我尽力解释模组开发的原理,但对某些人来说可能仍然令人困惑。本教程将带您逐步完成添加自定义商人的过程。
在本教程中,您需要具备创建数据包的基本知识。如果您不知道如何创建数据包,网上有很多资源可供参考。待办事项:找到一个好的教程并在此处链接
首先,你需要创建一个包含新函数的数据包。我会将我的函数命名为 new_merchant.mcfunction 并将其放在命名空间 mypack 中。
在 new_merchant.mcfunction 内部,我们需要初始化商人并设置其交易:
创建村民函数
#此命令用于商人的初始设置,分配名称、权重,并设置交易表
data modify storage clgd.trader:data NewMerchant append value {Weight:1,Name:"Special Merchant",TradeTable:[]}
# 我建议将此值 ^^^ 更改为唯一的值。如果多个数据包使用相同的值,则会出现一个数据包覆盖另一个的问题。
#这将第一组交易选项添加到交易表中
data modify storage clgd.trader:data NewMerchant.TradeTable append value []
#这向第一组交易添加了一个交易选项
data modify storage clgd.trader:data NewMerchant.TradeTable[-1] append value {TradeData:{buy:{id:"minecraft:coal",Count:48},sell:{id:"minecraft:diamond",Count:1}}}
#'data modify storage clgd.trader:data NewMerchant.TradeTable[-1]' 意味着我们正在修改最后一组交易选项。由于目前只有一组,这意味着我们正在修改第一组。
#这将第二组交易选项添加到交易表中
data modify storage clgd.trader:data NewMerchant.TradeTable append value []
#这向第二组交易添加了一个交易选项
data modify storage clgd.trader:data NewMerchant.TradeTable[-1] append value {TradeData:{buy:{id:"minecraft:diamond",Count:1},sell:{id:"minecraft:emerald",Count:2}}}
#向第二组交易添加第二个交易选项
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}}}
#现在有 2 组交易,'data modify storage clgd.trader:data NewMerchant.TradeTable[-1]' 指的是第二组交易
此函数将为拥有 2 组交易的商人创建数据。第一组交易将始终是 48 煤炭 -> 1 钻石,第二组交易将是 1 钻石 -> 2 绿宝石 或 5 煤炭块 -> 1 绿宝石
运行函数
现在我们已经编写了创建村民的函数,我们需要确保该函数被运行以初始化交易。这可以通过创建一个名为 clgd.trader 的新命名空间来完成,然后在该命名空间内创建一个名为 tags 的新文件夹,再创建一个子文件夹 functions,最后创建一个名为 set_default_trades.json 的文件。你还需要创建另一个名为 update_trades.json 的文件。
因此,你的文件夹结构应如下所示:
clgd.trader -> tags -> functions -> set_default_trades.json
set_default_trades.json 的内容应类似于:
{
"values": [
"mypack:new_merchant"
]
}
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 1
Name 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 earlier
TradeData (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 in sell
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 item
Count - (optional) the amount of the item. Probably defaults to 1
tag - (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"
]
}
评论 0
登录后参与评分
还没有评论,来抢沙发吧