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.
How to Install Data Trader (Mod)
Data Trader by MelanX is verified for Forge, Neoforge across Minecraft versions 1.18.2, 1.19, 1.19.1, 1.19.2, 1.19.3, 1.20.1, 1.21.1 (latest release: 21.1.0, file size: 82 KB). Follow the steps below to install it safely from ModCraft.tv:
- Click the Download button above and select your Minecraft version (1.18.2, 1.19, 1.19.1, 1.19.2, 1.19.3, 1.20.1, 1.21.1) and platform (Forge, Neoforge).
- Make sure you have the compatible loader or environment installed for Forge, Neoforge.
- Move the downloaded Data Trader file into your Minecraft
.minecraft/modsfolder and launch the game.
All Versions
+ Add Version- [fix default xp being 1 instead of 0](https://github.com/ChaoticTrials/DataTrader/commit/02194a834f2618f81646daf34c8c9867b45b0468) - *MelanX*
- [fix cycle duration being too high](https://github.com/ChaoticTrials/DataTrader/commit/49222c71f9a32d78abe090de5ed4e0013160b9ec) - *MelanX*
- [fix no ai traders being pushable](https://github.com/ChaoticTrials/DataTrader/commit/0cf1ef8a379a5658290f642cadf702e1b4c8ac63) - *MelanX*
- [fix skins not loaded on world join](https://github.com/ChaoticTrials/DataTrader/commit/442ef0a45d0213b2868a2a7327943a476b7b67ad) - *MelanX*
- [add way to implement textures for traders based on offer id](https://github.com/ChaoticTrials/DataTrader/commit/fcaeadc5dd5b7006673e34cae5245e36f4c066d0) - *MelanX*
- [fix screen title](https://github.com/ChaoticTrials/DataTrader/commit/fc418b214fc2d3d8b9dfac96bf4ef214dd280f98) - *MelanX*
- [fix shift inserting items](https://github.com/ChaoticTrials/DataTrader/commit/d041aef1cb692fac832f61ab3f1b078221f329a2) - *MelanX*
- [add show first resulting item when holding valid item in main hand](https://github.com/ChaoticTrials/DataTrader/commit/e47ff60f0e93158bb32a23164cff02a2c667f4b1) - *MelanX*
- [add config for picking up items to trade](https://github.com/ChaoticTrials/DataTrader/commit/89827e5b55bd2542fa1be836e9631694dae279cc) - *MelanX*
- [fix changing offer id doesn't update trades](https://github.com/ChaoticTrials/DataTrader/commit/5830130339c116f81a7bc149e7a4f15a05e02c93) - *MelanX*
- [prevent villager from disappearing](https://github.com/ChaoticTrials/DataTrader/commit/71d175b84e98097f3c94e87efa4a17cfaf6bd2c1) - *MelanX*
- [implement own trader with new recipe format which can accept tags as input](https://github.com/ChaoticTrials/DataTrader/commit/f71edab5f3c170fa2bd59e001c186f0d691f5495) - *MelanX*
- [add command to summon trader with offer id](https://github.com/ChaoticTrials/DataTrader/commit/b60ee1dfe0e0269d824e0fdb4335270584718205) - *MelanX*
- fix crash with citadel - MelanX
- fix spawn eggs not being in creative tab - MelanX
- update to 1.19.3 - MelanX
- add No AI eggs - MelanX
- add German translation - MelanX
- add missing translation - MelanX