村民交易
Villager Trades 是一款轻量级的 NeoForge 模组,适用于 Minecraft 1.21.1,允许整合包制作者和服务器管理员通过数据包来定义村民交易。
无需在 Java 代码中硬编码交易更改或修改模组本身,交易通过 JSON 文件进行控制。每个村民职业都有独立的配置文件,流浪商人的交易则单独处理。
功能
- 通过数据包添加自定义交易
- 按村民职业配置交易
- 配置流浪商人交易
- 仅当存在匹配的数据包文件时,替换原版交易
- 若不存在数据包文件,则保留原版交易不变
- 通过简单的配置选项启用或禁用模组的交易功能
- 兼容专用服务器和单人世界
工作原理
数据包交易文件需放置于以下路径:
data/villagertrades/trades/
支持的职业文件:
farmer.json
fisherman.json
shepherd.json
fletcher.json
cleric.json
weaponsmith.json
armorer.json
toolsmith.json
librarian.json
cartographer.json
leatherworker.json
butcher.json
mason.json
nitwit.json
wandering.json
如果存在有效的职业文件,该职业的原版交易将被移除,并替换为 JSON 文件中定义的交易。
如果某职业没有对应的文件,则该职业保留其原版交易。
流浪商人
流浪商人交易通过以下文件配置:
wandering.json
条目可使用:
"pool": "generic"
"pool": "rare"
若未指定池类型,交易将添加到通用池中。
当存在 wandering.json 文件时,原版流浪商人交易将被 JSON 中定义的交易替换。
配置
模组会生成一个通用配置文件:
config/villagertrades-common.toml
配置内容包含:
enabled = true
设置为 false 时,模组不会更改村民或流浪商人的交易。
交易示例
{
"trades": [
{
"level": 1,
"buy": { "item": "minecraft:emerald", "count": 1 },
"sell": { "item": "minecraft:diamond", "count": 1 },
"max_uses": 16,
"xp": 2,
"price_multiplier": 0.05
}
]
}
注意事项
- 村民交易等级范围为
1 至 5
- Minecraft 数据包资源路径必须使用小写字母
- 交易文件可以是 JSON 数组,也可以是包含
trades 数组的对象
- 本模组旨在用于基于数据包的自定义、整合包以及服务器端交易平衡
Villager Trades
Villager Trades is a lightweight NeoForge mod for Minecraft 1.21.1 that lets modpack makers and server owners define villager trades through datapacks.
Instead of hardcoding trade changes in Java or editing the mod itself, trades are controlled with JSON files. Each villager profession has its own file, and wandering trader trades are handled separately.
Features
- Add custom trades through datapacks
- Configure trades per villager profession
- Configure wandering trader trades
- Replace vanilla trades only when a matching datapack file exists
- Leave vanilla trades unchanged when no datapack file is present
- Enable or disable the mod's trade functionality through a simple config option
- Works on both dedicated servers and singleplayer worlds
How It Works
Datapack trade files are placed under:
data/villagertrades/trades/
Supported profession files:
farmer.json
fisherman.json
shepherd.json
fletcher.json
cleric.json
weaponsmith.json
armorer.json
toolsmith.json
librarian.json
cartographer.json
leatherworker.json
butcher.json
mason.json
nitwit.json
wandering.json
If a valid profession file exists, that profession's vanilla trades are removed and replaced with the trades from the JSON file.
If no file exists for a profession, that profession keeps its vanilla trades.
Wandering Trader
Wandering trader trades are configured with:
wandering.json
Entries can use:
"pool": "generic"
"pool": "rare"
If no pool is specified, the trade is added to the generic pool.
When wandering.json exists, vanilla wandering trader trades are replaced by the JSON-defined trades.
Config
The mod generates a common config file:
config/villagertrades-common.toml
The config contains:
enabled = true
When set to false, the mod does not change villager or wandering trader trades.
Example Trade
{
"trades": [
{
"level": 1,
"buy": { "item": "minecraft:emerald", "count": 1 },
"sell": { "item": "minecraft:diamond", "count": 1 },
"max_uses": 16,
"xp": 2,
"price_multiplier": 0.05
}
]
}
Notes
- Villager trades use levels from
1 to 5
- Minecraft datapack resource paths must be lowercase
- Trade files can contain either a JSON array or an object with a
trades array
- This mod is intended for datapack-driven customization, modpacks, and server-side trade balancing
评论 0
登录后参与评分
还没有评论,来抢沙发吧