Back to 9Minecraft
Wiki 9Minecraft Wiki 9Minecraft
Data Trader Wiki › Guides › Create a Basic Custom Trade with Data Trader

Create a Basic Custom Trade with Data Trader

Setting Up Your Trade File

Custom trades are defined using JSON datapacks. Create a new datapack in your world's datapacks folder, then navigate to data/namespace/ and create a folder for your trades.

Defining the Trade

Create a JSON file that specifies:

  • Input items: What the player gives to the trader
  • Output items: What the trader gives in return
  • Trade limits: How many times the trade can be used (optional)
  • Experience rewards: XP given upon successful trade (optional)

Structure your JSON with input and output arrays, specifying item IDs and stack sizes. For example, an input might require one emerald, while output could be a custom item or multiple stacks.

Loading Your Datapack

Place your completed datapack folder in the world's datapacks directory. Use /reload in-game to load it. Spawn a Data Trader using its spawn egg and interact with it—your custom trades should appear.

Test your JSON syntax carefully; malformed files will prevent trades from loading without error messages in most cases.