NBT & data editing · Java · Advanced

How to Edit Villager Trades, XP, and Gossip Data via Entity NBT

Customizing villager trades, experience levels, and player reputation directly in your Minecraft Java Edition world allows you to build tailored shops or fix broken trading halls without using in-game command blocks. Since Minecraft 1.17 separated entity storage from terrain chunks, villager data lives inside dedicated entity region files that can be modified with precision. Using the browser-based NBT Editor on world.9minecraft.net, you can inspect and rewrite a villager's Offers, Recipes, and Gossips tags locally on your machine without ever uploading your world files.

Open the NBT EditorOpen and edit any NBT file: level.dat, player data, structures, schematics, Bedrock files.

What you need

  • A Minecraft Java Edition world save (version 1.17 or newer for the separated entities folder structure)
  • The exact block coordinates (X, Y, Z) of the target villager
  • A complete backup copy of your world folder stored safely before making any edits
  • Access to the NBT Editor tool on world.9minecraft.net

Step by step

  1. 1Record the Villager Coordinates and Back Up Your World

    In Minecraft, stand right next to the villager you want to modify, press F3 to open the debug screen, and write down the exact X, Y, and Z block coordinates along with the Chunk and Region coordinates if shown. Completely exit the world to the main menu so the game flushes all pending entity data to disk and releases file locks. Before touching any files, duplicate your world folder in your `.minecraft/saves/` directory to create a safety backup in case an invalid NBT structure corrupts the chunk.

    Tip: To calculate the region file manually from block coordinates, divide the X and Z block coordinates by 512 and round down to the nearest whole number (for example, X=150, Z=-200 is inside r.0.-1.mca).

  2. 2Open the Entity Region File in the NBT Editor

    Launch the NBT Editor on world.9minecraft.net and click Open world folder or .zip to load your save directly into the browser. Navigate to the `entities` folder for the Overworld (or `DIM-1/entities` for the Nether and `DIM1/entities` for the End) and select the `.mca` region file matching your villager's location, such as `r.0.0.mca`. Expand the chunk entry corresponding to your villager's chunk coordinates, open its root compound tag, and expand the `Entities` list tag to view all entities stored in that chunk.

    Tip: If a chunk contains dozens of mobs, look through each compound entry for the string tag `id` set to `minecraft:villager` and verify its `Pos` list tag (three double values for X, Y, Z) matches the coordinates you wrote down.

  3. 3Adjust Villager Profession, Level, and Experience

    Inside the target villager's compound tag, locate the `VillagerData` compound tag and expand it to find `level` (int), `profession` (string, such as `minecraft:librarian`), and `type` (string, such as `minecraft:plains`). At the root level of the villager entity, locate the `Xp` integer tag, which tracks total trading experience and prevents the villager from losing its profession once above 0. Set `level` between 1 (Novice) and 5 (Master) and adjust `Xp` to match standard progression thresholds so the trade UI bar renders properly (typically 0 for level 1, 10 for level 2, 70 for level 3, 150 for level 4, and 250 for level 5; check a naturally leveled villager in your version if you are unsure of the exact threshold).

    Tip: Raising `level` in NBT without unlocking trades in game will not automatically generate new trades until the villager levels up normally, unless you also add or edit the entries in the `Recipes` list manually.

  4. 4Edit Trades Inside the Offers and Recipes Tags

    Still inside the villager's compound tag, expand the `Offers` compound tag and then open the `Recipes` list tag, where each numbered compound represents one trade slot. Inside a trade compound, expand `buy` (the primary cost item), `buyB` (the optional secondary cost item; set `id` to `minecraft:air` or `Count` to 0 if unused in older versions, or omit/clear it depending on your game version's schema), and `sell` (the output item), editing their `id` string and `Count` byte tags to change the items and quantities. You can also edit `maxUses` (int) to control how many times the trade can be performed before locking, `uses` (int) to reset current lock progress to 0, `priceMultiplier` (float) to control supply-and-demand inflation, and `xp` (int) to set how much villager XP each trade grants.

    Tip: If your villager is running Minecraft 1.20.5 or newer, enchanted books and custom items inside `buy` and `sell` use the `components` compound tag rather than the legacy `tag` compound; inspect an existing enchanted trade in your world first to match the exact format for your version.

  5. 5Modify Discounts and Penalties in the Gossips List

    Locate the `Gossips` list tag on the villager's root compound to inspect how the villager feels about specific players, which directly drives permanent and temporary price discounts. Each compound entry inside `Gossips` contains a `Target` (an IntArray of four integers representing a player's UUID), a `Type` string (`major_positive` for curing a zombie villager, `minor_positive` for trading, `minor_negative` for hitting the villager, or `major_negative` for killing a villager), and a `Value` integer. To grant maximum curing discounts, set or create a `major_positive` entry with your player's `Target` UUID array and set `Value` to 20 (or up to 100 depending on the cap in your specific Java version), and delete any `minor_negative` or `major_negative` entries.

    Tip: If you do not know your player's four-integer UUID array, trade with the villager once before closing the world so the game automatically generates a `trading` (`minor_positive`) gossip entry containing your exact `Target` IntArray.

  6. 6Save and Replace the Modified Entity File

    After reviewing your changes in the NBT Editor on world.9minecraft.net, click the Save or Export button to download the updated `.mca` region file (or the entire updated world `.zip` if you loaded an archive). Copy the downloaded `.mca` file back into your world's `entities` folder, overwriting the original file while Minecraft is closed or while the world is unloaded on the main menu. Load your world in Minecraft and open the villager's trading interface to confirm your custom trades, XP level, and gossip discounts are active.

How it works

Starting in Minecraft Java Edition 1.17, Mojang decoupled entity data from terrain chunk data to improve chunk loading performance. While blocks, biomes, and block entities (like chests and signs) remain inside the `region/` folder, all mobile entities—including villagers, mobs, boats, and dropped items—are saved in parallel `.mca` Anvil files inside the `entities/` folder. Each `.mca` file covers a 32x32 chunk area (512x512 blocks), and each populated chunk inside that file stores a root compound containing an `Entities` list tag.

A villager's trading economy is driven by the interaction between three main NBT structures: `VillagerData`, `Offers`, and `Gossips`. The `Offers` compound holds the `Recipes` list, which evaluates the baseline price of a trade using the `buy` item's `Count` tag, modified dynamically by `specialPrice` (temporary direct modifiers), `demand` (an integer that rises when a trade is used repeatedly at restock time), and `priceMultiplier` (usually 0.05 for common trades or 0.2 for high-value items).

The `Gossips` list feeds directly into the special price calculation whenever a player opens the trading screen. Each gossip `Type` has a built-in weight multiplier in the game engine: `major_positive` (weight 5) and `minor_positive` (weight 1) subtract from the base item cost, whereas `minor_negative` (weight -1) and `major_negative` (weight -5) add to the cost. By matching the four-integer `Target` UUID array to a player and setting positive `Value` integers, the game calculates a negative special price offset on the fly, dropping costs down to a minimum of 1 item.

Common mistakes

  • Looking for the villager inside the `region` folder instead of the `entities` folder in worlds running Minecraft 1.17 or newer, where chunk files in `region` no longer hold mobile entities.
  • Editing the `.mca` file while the world is still open and running in Minecraft, which causes the integrated server to overwrite your custom NBT changes the moment the chunk unloads or autosaves.
  • Setting `Xp` to 0 on a villager that has customized trades in `Recipes`, which allows the villager to lose its profession and wipe its entire `Offers` compound if its job site block is broken or unclaimed.
  • Entering an invalid item namespace or using the wrong data tag format for your version (such as using the legacy `tag` compound instead of `components` in Java 1.20.5+), which can cause the trade slot to disappear or reset when the chunk loads.

FAQ

Why does my villager have no Offers or Recipes tag in the NBT Editor?

Unemployed villagers, nitwits, and newly employed villagers whose trading interface has never been opened by a player often do not generate the `Offers` compound until they first claim a workstation and generate trades; interact with the villager in game once, save the world, and reload the file in the NBT Editor.

How do I stop a custom villager from ever locking its trades?

Inside each compound in the `Recipes` list, change the `maxUses` integer tag to a very large number such as `2147483647` (the maximum 32-bit signed integer) and set `uses` to `0`.

Why did my curing discount stop stacking after I increased the major_positive gossip value?

In recent Java Edition updates (starting around 1.20.2), Mojang capped the maximum `major_positive` gossip value from curing zombie villagers at 20, meaning setting higher numbers in NBT may be clamped by the game engine when the villager ticks; if you need steeper discounts, lower the base `Count` inside the recipe's `buy` tag directly.

By locating a villager inside your world's `entities` region files with the browser-based NBT Editor on world.9minecraft.net, you can safely customize its `VillagerData`, `Offers/Recipes`, and `Gossips` tags to control every trade, XP level, and player discount locally.

More nbt & data editing guides

NBT & data editingHow to Edit Chest Contents, Sign Text, and Command Blocks Inside Chunk NBTEvery placed container, sign, and command block in a Minecraft Java Edition world stores its detailed state inside the region files as a block entity. When you need to clear a lag-inducing chest, edit a sign without breaking it, or disable a soft-locking repeating command block, you can modify these properties directly in the chunk data. This guide explains how to locate and edit placed block entities using our browser-based NBT Editor.JavaAdvanced5 steps
NBT & data editingHow to Open and Edit Any Minecraft NBT or .dat File in Your BrowserMinecraft stores almost all of its world rules, player inventories, and entity details inside Named Binary Tag (NBT) files, which normally look like unreadable gibberish in a standard text editor. With the browser-based NBT Editor on world.9minecraft.net, you can decode, navigate, and modify any .dat or .nbt file directly on your device. Because the tool runs locally in your browser, your save files are processed instantly and never upload to an external server.Java & BedrockBeginner5 steps
NBT & data editingHow to Inspect and Modify Structure Block .nbt FilesMinecraft Structure Blocks save custom builds as standalone .nbt files, allowing you to transfer creations between worlds or use them in custom data packs. Instead of rebuilding a structure in-game just to swap out one building material or remove accidentally captured mobs, you can directly edit the saved structure data. Our browser-based NBT Editor lets you inspect and modify these files locally on your device without uploading anything to a server.JavaIntermediate5 steps
NBT & data editingHow to Edit Objectives, Teams, and Player Scores in scoreboard.datUninstalling complex datapacks often leaves your world cluttered with hundreds of obsolete scoreboard objectives and orphaned player scores. By manually editing the scoreboard.dat file offline, you can instantly clean up your world data, modify player statistics, or tweak team settings without typing tedious in-game commands. Because the NBT Editor runs entirely inside your browser, your world files are processed locally on your device and never upload to a server.JavaIntermediate6 steps
NBT & data editingMinecraft NBT Data Types Explained: Byte, Short, Int, Long, Compound, and ArraysModifying Minecraft world files requires a clear understanding of the Named Binary Tag (NBT) format, as entering a value outside a tag's strict mathematical boundaries will immediately break your save. This guide breaks down all thirteen binary data types across both Java and Bedrock Editions so you can edit values safely without causing data overflow or chunk resets. You will learn how to inspect and modify these exact tag types directly inside your browser using our local NBT Editor.Java & BedrockIntermediate5 steps