promotional bannermobile promotional banner

Trade GUI

This is a datapack that allows players to create, manage, and operate store systems with custom item trading and GUI interfaces in vanilla Minecraft.

Minecraft Trade GUI Datapack

A powerful, highly customizable vanilla Minecraft trading shop system datapack.

About the Author

Author: YChenY5260

Datapack Introduction

This datapack utilizes Minecraft's vanilla datapack capabilities and new features from version 1.21.8+ to implement a fully customizable shop trading system. You no longer need to rely on villagers! You can create your own shops, set any items as currency and goods, provide an intuitive GUI interface for other players to trade with, and it requires almost no writing of tedious Json files.

Features

  • Shop Creation & Management: Use specific tools to generate shop entities and customize their name, appearance color, and number of supported pages.
  • Dual Modes:
    • Edit Mode: The shop owner can directly place items within the shop interface to set up trades.
    • Open Mode: Customers can trade with the shop.
  • Multi-Page System: A single shop supports up to 30 pages, making it easy to organize a large number of trades.
  • Complex Trade Logic: Supports trading one item for multiple goods, and complex trades requiring multiple types of currency.
  • Visual Preprocessing: Provides a trade item "crafting" system. Automatically generates complex trade items by placing items in a chest, greatly simplifying the setup process.
  • Powerful Algorithm Core: Includes a self-developed algorithm library supporting loops, arithmetic operations, and other advanced features, providing strong support for the system.

Usage Instructions

  1. Install the Datapack

    • Place the downloaded .zip file into the datapacks folder of your world (/.minecraft/saves/<Your World Name>/datapacks/).
    • In-game, type /reload or re-enter the world to load the datapack.
    • A success message will indicate successful installation.
  2. Obtain Tools

    • Use the command /function give:<tool_name> in-game to get tools.

    Tool names can be:

    • summon_trader: Summon Trader Tool - Used to create a new shop entity
    • trader_mode_switcher: Shop Mode Switcher - Used to switch the shop between Edit and Open modes
    • trader_setting_tool: Trader Setting Tool - Used to set basic shop information (Deprecated)
  3. Create Your First Shop

    • Use the Summon Trader Tool. Follow the dialog prompts to input the shop name, color, and number of pages to generate a shop entity (a Minecart with Chest).
    • Hold the Shop Mode Switcher and right-click the shop to switch it to Edit Mode (Move back a bit; successful switch is indicated by text above the shop).
    • Use the command /tag @s add editing to grant yourself editing permissions.
    • Right-click to open the shop interface. Place the items you want to sell (trade items) as if organizing a chest. How to get trade items? See "Preprocessing System" below.
    • After editing, use the Shop Mode Switcher again to switch back to Open Mode.
    • Use the command /tag @s remove editing to remove your editing permissions. Now you can right-click to open the shop and trade with it!

    Tips:

    • In Edit Mode, you can edit the GUI border of the shop (but never remove the Previous Page and Next Page buttons, though it is not recommended.
  4. Preprocessing System

    • Place a regular chest on top of a command block.
    • Write the command function pre_process:chest_generator in the command block.
    • Open the chest and place items in the corresponding slots:
      • First Row (Slot 0): Place the desired "icon item" for the trade item display (any item)
      • Second Row (Slots 9-17): Place items the customer should receive (up to 9 types)
      • Third Row (Slots 18-26): Place items the customer should pay (up to 9 currency types)
    • Close the chest and activate the command block (provide redstone power).
    • Reopen the chest to collect the generated trade item. Place it in your shop interface!

    Tips:

    • All items support custom names/lore
    • Custom currency requires unique custom_data component
    • Grant yourself editing permissions before taking trade items (/tag @s add editing)
  5. Trading Process

    • Ensure you do not have editing permissions (/tag @s remove editing). Open the "Shop".
    • Carry sufficient currency. Click on the desired good (trade item).
    • Success: Hear confirmation sound + receive goods + currency consumed
    • Failure: Chat message shows missing currency (hover for details)

Advanced Usage & Customization

Core configuration uses scoreboards and Storage:

  • Modify Page Limit (Default: 30)
    Edit data/<namespace>/dialog/trader_summoner.json (requires JSON knowledge)
    (Advanced customization typically requires direct function file modification)

Compatibility

  • Requires Minecraft Java Edition 1.21.8+ (Datapack v81+)
  • Uses Dialog system introduced in 1.21.8
  • Theoretically compatible with future versions

License

MIT License - Free for personal/commercial use with attribution. See LICENSE file.

The Trade GUI Team

profile avatar
  • 1
    Projects
  • 76
    Downloads