Overview#
Villager Trade Tables is a powerful utility mod for Minecraft that brings the flexibility of Loot Tables to the villager trading system. By using JSON configuration files, players and modpack creators can completely overhaul how villagers trade, allowing for the addition of new professions, the creation of custom careers, and the precise control over which items are bought and sold.
The mod is designed to be data-driven, meaning no coding knowledge is required to modify trades. It supports complex item data, including metadata, NBT tags, and randomized quantity ranges, making it an essential tool for map makers and modpack developers who want to integrate custom economies.
File Structure and Loading#
All configuration for the mod is handled through JSON files located in the following directory:
config/villagertradetables/
Loading Rules
- Automatic Detection: The mod scans this folder upon game startup and loads every
.jsonfile found within. - Alphabetical Order: Files are processed in alphabetical order. This is important when multiple files modify the same profession or career, as later files can override or add to the changes made by earlier ones.
- Syntax Validation: If a JSON file is incorrectly formatted, the mod will log an error in the console and skip that specific file.
Professions and Careers#
In Minecraft, villagers are organized into a hierarchy: Professions (the broad category, like Priest) and Careers (the specific subtype, like Cleric).
Adding Professions
To create a brand new profession, you define a profession object in your JSON. This requires a unique ID and can optionally include a custom texture for the villager's skin.
Adding Careers
Careers are nested within professions. A single profession can have multiple careers. For example, the vanilla 'Smith' profession includes the 'Armorer', 'Weapon Smith', and 'Tool Smith' careers.
Adding Career Levels
Trades are assigned to specific Career Levels. As a player trades with a villager, the villager gains experience and levels up, unlocking the trades associated with the next level. This mod allows you to define exactly which trades appear at levels 1 through 5.
Customizing Trades#
The core of the mod is the Offers array, which contains individual trade definitions. Each trade uses an action key to determine how it interacts with the villager's existing trade pool.
Adding Trades
To add a new trade, use the "action": "add" command. You must specify the CareerLevel and the items involved in the transaction.
Removing Trades
To remove a vanilla or modded trade, use "action": "remove". This is particularly useful for balancing modpacks by removing overpowered trades or items that bypass progression.
| Property | Description |
|---|---|
action |
Either add or remove. |
CareerLevel |
The level (1-5) at which this trade becomes available. |
buy |
The primary item the villager wants from the player. |
buyB |
(Optional) A second item the villager wants. |
sell |
The item the villager gives to the player. |
Chance |
(Optional) The decimal probability (0.0 to 1.0) of this trade being selected. |
Trade Syntax Guide#
Items in the JSON files are defined as objects. This allows for high precision when specifying trade requirements.
Item Object Properties
- id: The registry name of the item (e.g.,
minecraft:emerald). - Damage: The metadata or durability value of the item.
- Count: The number of items. This can be a single integer or a range object.
- NBT: A string representation of the item's NBT data (e.g.,
"{display:{Name:\"Legendary Sword\"}}").
Quantity Ranges
Instead of a fixed number, you can provide a range to randomize the trade costs:
"Count": { "min": 1, "max": 5 }
Example Trade JSON
Below is an example of a trade that adds a custom transaction to the Cleric career:
{
"Profession": "minecraft:cleric",
"Career": "cleric",
"Offers": [
{
"action": "add",
"CareerLevel": 1,
"buy": { "id": "minecraft:rotten_flesh", "Count": 32 },
"sell": { "id": "minecraft:emerald", "Count": 1 }
}
]
}Included Content#
The mod comes pre-packaged with several new villager careers to demonstrate its capabilities. These villagers use custom robes and offer specialized trades.
New Careers
- Brewer (Yellow Robe): Focuses on potion ingredients, glass bottles, and brewed potions.
- Redstoner (Red Robe): Trades in redstone components, machinery, and ores.
- Tinkerer (Blue Robe): Offers various utility items and materials.
- Necromancer (Purple Robe): A new career for the Priest profession that trades in undead-related drops and dark artifacts.
Client-Only Resources#
When creating custom professions, the names and textures are not automatically generated. These are handled via standard Minecraft Resource Packs.
Localization
To give your custom profession or career a proper name in the trading UI, you must add entries to a lang file within a resource pack:
entity.Villager.[profession_name].nameentity.Villager.[profession_name].[career_name].name
Textures
Villager textures are located in assets/minecraft/textures/entity/villager/. If you define a custom texture in your JSON file, the mod will look for that file path within your active resource packs.