Data Trades

Data Trades

Allows easy customization of villager trades using datapacks

by
10.6K Downloads
fabricforgeneoforgeeconomymanagementutility
Rent Server with this Mod

About this Mod

Data Trades

This mod adds the ability for players, serverowners or modpack creators to overwrite villager trades using datapacks.
The amount of trades per level and the actual items traded can be customized using json files.
A command for development purposes called /villagers refresh will manually trigger a re-asign of trades to all loaded villagers.

Folder Structure

Using a datapack, the trades of a specific villager profession can be overwritten by creating a JSON file following this
pattern:

data/[namespace]/villager/professions/[path].json

[namespace] and [path] should be overwritten by the specific villager professions ID.
For example, to create trades for the minecraft:fletcher profession,
a file under data/minecraft/villager/professions/fletcher.json should be created.
It's content should follow the Profession Schema

Similar, the wandering trader can be overwritten by adding a file at

data/minecraft/villager/traders/wandering.json

following the Trader Schema

Examples

Datapacks with examples can be found here.

JSON Schema

The JSON file should contain an object with these properties:

Profession

Property Type Default Description
levels map<int,TradeLevel> {} see below

The levels object takes the form of a map with numeric keys and object values.
The keys represent the actual villagers level with 1 being Novice until 5 being Master.

Trader

Property Type Default Description
generic TradeLevel null generic trades
rare TradeLevel null rare trades

In vanilla minecraft, each wandering trader chooses 5 generic and 1 rare trades once it spawns.
Both the trades themselves and their count can be overwritten using the same format as the one used for a villager's level.

TradeLevel

Property Type Default Description
take NumberProvider null amount of trades added by this level
trades (Trade | string)[] [] list of trades from which the taken ones are randomly choosen

Trade

Property Type Default Description
disabled boolean false disabled trades will be ignored
sells TradeIngredient [] item sold to the player
wants TradeIngredient[] [] maximum of two items the player has to pay
uses int 0
maxUses int 10
xp int 1
priceMultiplier float 2.0
demand int 0

TradeIngredient

Extension of the vanilla Ingredient with a few extra properties.
They can take the form of an item or tag and specify all properties of the vanilla Ingredient JSON.
Since Villager trades are ItemStack based that does not mean that a player can pay a #minecraft:stone_tool_materials
with any stone type, but only the one that is randomly selected from the tag each time the trade is used.

Property Type Default
functions LootFunction[] []
count int null

The levels object takes the form of a map with numeric keys and object values.
The keys represent the actual villagers level with 1 being Novice until 5 being Master.

Advanced Usage

Instead of a Trade object, the TradeLevel trades property can also contain string IDs referencing an external
trade.
These trades can be saved under the path below to organize & reuse them.

data/[namespace]/villager/trades/[path].json

Available Versions

Forge 2.1.1release
MC 1.20.1forge
September 27, 2023
Fabric 2.1.1release
MC 1.20.1fabric
September 27, 2023
Forge 1.1.1release
MC 1.19.2forge
September 27, 2023
Fabric 1.1.1release
MC 1.19.2fabric
September 27, 2023
Forge 2.1.0release
MC 1.20.1forge
September 22, 2023

How to Install Data Trades on Your Server

1

Order Server

Order a Minecraft Java server with at least 3 GB RAM (4 GB recommended).

2

Set fabric Loader

In the panel under "Egg", select the fabric loader and matching Minecraft version (1.21.1).

3

Install Mod

Open the mod browser in the dashboard and search for "Data Trades". Click "Install" – done! Alternatively, upload the .jar via SFTP to the /mods folder.

Compatibility

Mod Loaders

fabricforgeneoforge

Minecraft Versions

1.21.1, 1.20.1, 1.19.2

Server-side

Required

Recommended RAM

4 GB(min. 3 GB)

Frequently Asked Questions

Data Trades server crashes on startup – what to do?

Most common cause: wrong fabric version or insufficient RAM. Check the server log (latest.log) for "OutOfMemoryError" or "Mixin" errors. With Mado Hosting: ensure at least 3 GB RAM is allocated and the loader matches the mod version (1.21.1). You can switch loaders with one click in the panel.

Is Data Trades compatible with fabric and forge and neoforge?

Data Trades officially supports fabric, forge, neoforge for Minecraft 1.21.1, 1.20.1, 1.19.2. Note: Forge and Fabric mods are NOT cross-compatible – pick one loader and stick with it. The Mado dashboard automatically detects incompatible loader combinations.

Server lagging with Data Trades – how to optimize performance?

Recommended RAM: 4 GB (per 8 players). Use /spark profiler to check if Data Trades consumes the most tick time. Common fixes: reduce server view-distance to 8-10, install "performant" or "starlight" as supplementary mods on Forge. With Mado Hosting, your server runs on NVMe SSDs with dedicated CPU cores for minimal latency.

Rent Modded Server

Install Data Trades with just one click on your server.

Recommended RAM
4 GBab €8/mo
Min. 3 GB | +1 GB pro 8 Spieler
Create Server Now
1-Click Mod Install
NVMe SSD Storage
DDoS Protection included

Details

License
Creative Commons Zero v1.0 Universal
Server-side
Required

Supported Versions

1.21.11.20.11.19.2