Back to 9Minecraft
Wiki 9Minecraft Wiki 9Minecraft
Villager Config Wiki › Guides › How to Set Up Custom Villager Trades with a Datapack

How to Set Up Custom Villager Trades with a Datapack

Creating the Datapack Structure

Custom trades in Villager Config Mod are loaded from datapacks, so you never touch the mod's own files. In your world's datapacks folder, create a new folder for your pack and add a pack.mcmeta file so Minecraft recognizes it. Inside, create a data directory, then a namespace folder (any name you like), and within that a villager_trades folder. This is where your trade definition files live.

Writing a Trade File

Each trade file is a JSON document. You define which profession or trader type the trade belongs to, the items being bought and sold, and how many. Villager and wandering trader trades are handled separately, so make sure you target the correct trader type in the file. After saving, run /reload in-game so the datapack is picked up, then spawn or refresh a villager of that profession to see the new trades.

Testing Your Trades

Summon a fresh villager with the matching profession and open its trade screen. If nothing changed, double-check your JSON syntax and that the namespace path matches what the mod expects. Remove the datapack and reload to revert to vanilla trades if something breaks.