How to make custom Minecraft villagers
VillagerAPI is a Minecraft mod that adds villagers from data files. With a villager pack you can add new villager professions, villager types, trades, Hero of the Village gifts, wandering trader trades and village houses without writing code.
What you need
- VillagerAPI for Fabric or NeoForge. It runs on Minecraft 1.21.1, 1.21.11, 26.1.2, 26.2, 26.3 and the 26.4 snapshot (Fabric only on 26.4).
- A villager pack. Make one with the villager pack generator, start from a pack on Villager Packs, or write the JSON files by hand.
Install a villager pack
- Install VillagerAPI and start the game once. A
villagerpacksfolder appears in your game folder. - Put the pack in that folder. It can be a plain folder, a
.zipor a.jar. - Start the game. The log lists every pack VillagerAPI found and anything wrong with it.
On a server, install VillagerAPI on the server and on every player's game, and use the same packs on both. Mods can also ship a villager pack inside their jar, which is how More Villagers: Re-employed adds its ten professions.
What a villager pack can add
| Folder | What it adds |
|---|---|
villagers/workstations | Workstation blocks for your professions. |
villagers/poi_types | Links a workstation block to a profession, so unemployed villagers take the job. |
villagers/professions | New villager professions with their work sound and look. |
villagers/types | Villager types, the regional looks like desert or snowy villagers. |
villagers/biome_mappings | Which villager type spawns in which biome. |
villagers/trades | Trades from Novice to Master, for your professions or vanilla and modded ones. |
villagers/biome_trades | Trades only villagers of certain types offer. |
villagers/gifts | What villagers throw to the Hero of the Village. |
villagers/structure_tags | Explorer maps that lead to any structure. |
villagers/wandering_trader | Wandering trader trades. See the wandering trader guide. |
villagers/village_types, village_structures | New villages and village houses. |
Every pack also has a villagerapi_config.json with its namespace, name and version, and a pack.mcmeta.
Custom villager trades
Trades are written per profession and per level, from 1 (Novice) to 5 (Master). On Minecraft 1.21.11 and newer they use the game's own trade format:
{
"profession": "minecraft:farmer",
"levels": {
"1": [
{
"wants": { "id": "minecraft:wheat", "count": 30 },
"gives": { "id": "minecraft:emerald" },
"max_uses": 16,
"xp": 2
}
]
}
}
This adds a wheat trade to every novice farmer and keeps their usual trades. Set "replace": true on a level to swap out the original trades instead, use trade_list_amount to give each villager a random few of your trades, and trade_list_max to cap the total. Items can carry components, so enchanted gear, potions and named items all work, and explorer maps can lead to any structure.
Questions
Can I change vanilla villager trades?
Yes. Point a trade file's profession at a vanilla or modded profession, such as minecraft:librarian, and add to or replace any of its levels.
Can I change the wandering trader?
Yes. A pack can add trades to the wandering trader, remove trades for any item, change how many trades it offers, add new trade pools or replace its trades entirely. The generator's Wandering Trader panel does it without writing JSON, and the wandering trader guide explains every option.
Which Minecraft versions are supported?
VillagerAPI runs on 1.21.1, 1.21.11, 26.1.2, 26.2, 26.3 and the 26.4 snapshot with Fabric or NeoForge (Fabric only on 26.4), and the generator exports packs for every one of them. On 26.1.2 and 26.2 VillagerAPI is more limited: it has no new villages or village houses, no replace or trade_list_max on trade levels, and biome mappings only take single biomes, without tags or weights. Trades for an existing profession also work differently there: they join its trade pool, and the villager offers as many trades as you listed, picked from vanilla's and yours together. The generator leaves the unsupported options out when you pick 26.1.2 / 26.2. Pick the version you play before you download, since some files differ between versions.
Where is the full reference?
Every field is described in the documentation for Minecraft 26.x and 1.21.11 and Minecraft 1.21.1.