Data Trader
一个为游戏添加新商人模组的模组。
定义交易
文件结构
商人可以接收一个用于商人交易“配方”的 ID。这是一个包含单个 trader offer(商人交易)的列表。示例文件可能如下所示:
1.20.1
{
"Offers": [
{
"buy": {
"tag": "forge:gems/diamond",
"count": 3
},
"buyB": {
"item": "minecraft:wooden_pickaxe"
},
"sell": {
"item": "minecraft:diamond_pickaxe",
"nbt": "{Damage:0,Enchantments:[{id:\"minecraft:efficiency\",lvl:2},{id:\"minecraft:unbreaking\", lvl:10}]}"
},
"rewardExp": false,
"xp": 0
}
]
}
1.21.1
{
"Offers": [
{
"buy": {
"count": 1,
"items": {
"item": "minecraft:wooden_pickaxe"
}
},
"buyB": {
"count": 3,
"items": {
"tag": "c:gems/diamond"
}
},
"sell": {
"components": {
"minecraft:enchantments": {
"levels": {
"minecraft:efficiency": 2,
"minecraft:unbreaking": 10
}
}
},
"count": 1,
"id": "minecraft:diamond_pickaxe"
}
}
]
}
此示例仅包含一个商人交易。商人将出售 sell 中的物品。
玩家需要提供 buy 和 buyB 中的物品才能换取该物品。
maxUses 是商人在补货前允许玩家进行此交易的次数。
如果 rewardExp 为 true,则玩家每次交易后将获得经验值,具体数量由 xp 定义。
以下值为必填项:
buysell
默认值如下:
| 名称 | 默认值 |
|---|---|
buyB |
Air |
rewardExp |
false |
xp |
0 |
放在哪里?
你使用数据包来提供这些文件。它们位于 <modid>/trader_offers/ 目录下。示例可以在
这里 找到。
如何使用?
你可以使用 /summon 命令或生成蛋来召唤商人。之后,使用命令
/datatrader setOffer @e <modid>:<path> 来设置配方。这也可以通过数据包完成。
对于普通商人,建议将 NoAI 设置为 true。
你也可以通过使用命令 /datatrader summon ~ ~ ~ <offer_id> <NoAI> 来召唤带有特定交易台的商人。
设置自定义皮肤叠加层
只需将纹理放入 <modid>:textures/entity/trader/<offer_id path>.png。此纹理应类似于职业叠加层纹理,例如 minecraft:textures/entity/villager/profession/cleric.png。
你可以随意将此模组放入任何整合包中。
Porting information for 26.1 update
Data Trader
A mod which adds a new trader to the game.
Defining the trades
File structure
The trader can receive an ID for a trader offers "recipe". This is a list of single trader offers. An example
file could look like this:
1.20.1
{
"Offers": [
{
"buy": {
"tag": "forge:gems/diamond",
"count": 3
},
"buyB": {
"item": "minecraft:wooden_pickaxe"
},
"sell": {
"item": "minecraft:diamond_pickaxe",
"nbt": "{Damage:0,Enchantments:[{id:\"minecraft:efficiency\",lvl:2},{id:\"minecraft:unbreaking\", lvl:10}]}"
},
"rewardExp": false,
"xp": 0
}
]
}
1.21.1
{
"Offers": [
{
"buy": {
"count": 1,
"items": {
"item": "minecraft:wooden_pickaxe"
}
},
"buyB": {
"count": 3,
"items": {
"tag": "c:gems/diamond"
}
},
"sell": {
"components": {
"minecraft:enchantments": {
"levels": {
"minecraft:efficiency": 2,
"minecraft:unbreaking": 10
}
}
},
"count": 1,
"id": "minecraft:diamond_pickaxe"
}
}
]
}
This example includes only one merchant offer. The trader will sell the item in sell.
The player needs to provide the item in buy and buyB to receive the item.
maxUses is the amount of times the player can use this trade before the trader needs to restock.
If rewardExp is true, the player will receive xp points for each trade, amount defined in xp.
The following values are required:
buysell
The default values are:
| Name | Default value |
|---|---|
buyB |
Air |
rewardExp |
false |
xp |
0 |
Where to put it in?
You use a data pack to provide these files. These are located at <modid>/trader_offers/. An example can be found
here.
How to use?
You spawn the trader using the /summon command, or by using the spawn egg. After this, you use the command
/datatrader setOffer @e <modid>:<path> to set the recipe. This can also be done by datapacks.
For a normal trader, I recommend setting NoAI to true.
You can also summon a trader with a specific trading table by using the
command /datatrader summon ~ ~ ~ <offer_id> <NoAI>
Setting custom skin overlay
Just put a texture to <modid>:textures/entity/trader/<offer_id path>.png. This texture should be something like the
profession overlay texture, e.g. minecraft:textures/entity/villager/profession/cleric.png.
You are allowed to put this mod in any modpack you like.
下载 Data Trader
下载 Data Trader
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Data Trader
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Data Trader
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Data Trader
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Data Trader
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Data Trader
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Data Trader
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Data Trader
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Data Trader
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
- 1.21.1 - MelanX
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
添加全屏世界地图,显示你在世界中已探索的区域。与 Xaero's Minimap 搭配使用效果极佳。
模组
让你能够在世界中的任何位置定位结构。
模组
对 Minecraft 的沙漠神殿进行了全面重新设计!
模组
感受痛苦!
模组
TerraFirmaCraft (TFC) 是一个全面转换模组,对生存模式进行了彻底的改造与重新设计。
评论 0
登录后参与评分
还没有评论,来抢沙发吧