Compatibility
Minecraft: Java Edition
Platforms
Supported environments
Links
Creators
Details
ItemMarket ā InāGame Item Buy/Sell Market (Fabric)
EN
ItemMarket adds a simple, fast ināgame market GUI where players can buy and sell items using a builtāin coin balance saved per-world. Prices are fully configurable via easy JSON files, and the mod exposes a small Java/Fabric API so other mods can read/write player balances and listen to market transactions.
Credits: Developed by TNTStudios ā Website: TNTStudios.space ā Socials: @TNTStudiosn
Features
EN
- ā Client GUI market (open with M by default)
- ā Buy 1 item at a time (server-authoritative)
- ā Sell 1 or all of an item in your inventory
- ā Built-in economy stored per world (PersistentState)
- ā Price configuration via JSON (per-price file, item list inside)
- ā Client price sync on join
- ā
Public API (
ItemMarketAPI) to get/add/remove coins - ā
Event callback (
MarketTransactionCallback) when a transaction succeeds
Requirements
EN
- Minecraft: Fabric-based environment (client + server)
- Fabric Loader + Fabric API
- Installed on both server and client (because the market is a client GUI that talks to the server)
If you only install it on the server, players wonāt have the GUI/keybind and wonāt be able to use the market.
Installation
EN
- Install Fabric Loader and Fabric API for your Minecraft version.
- Drop the ItemMarket
.jarinto:- Client:
mods/ - Server:
mods/
- Client:
- Launch the game/server once to generate the config folders.
How to Use (Players)
EN
- Join the world/server.
- Press M to open the market.
- You can rebind the key in Options ā Controls (search for āItemMarketā).
- Choose:
- Buy (green) ā buy items using your coins
- Sell (gold) ā sell items from your inventory
- Scroll the item list and click an item:
- Buy: confirm to purchase 1
- Sell: choose Sell 1 or Sell All
- Your balance is shown at the top-right of the screen.
What happens when you buy?
EN
- The server checks the configured buy price for that item.
- If you have enough coins, it subtracts coins and gives you 1 item.
What happens when you sell?
EN
- The server checks the configured sell price for that item.
- If you have the item:
- Sell 1: removes 1 item, adds coins
- Sell All: removes all stacks of that item, adds coins for total quantity
Economy System (How coins are saved)
EN
- Balances are stored on the server using
PersistentState, per world. - Data key:
itemmarket_economy - Money is stored as a Long per player UUID.
- New players start with 0 coins unless another mod (or your custom code) adds coins via the API.
Price Configuration (JSON)
ItemMarket reads prices from:
config/ItemMarket/compra/
config/ItemMarket/venta/
EN
compra/= BUY prices (player pays coins to get items)venta/= SELL prices (player receives coins to sell items)
File naming rule
EN
Each .json filename must be a number, and that number is the price.
Examples:
config/ItemMarket/compra/100.jsonā buy price = 100 coinsconfig/ItemMarket/venta/25.jsonā sell price = 25 coins
If the filename is not purely numeric, it will be skipped.
Important: price 0 is valid as a filename (
0.json) but will not work in-game because transactions requireprice > 0. Use 1+.
JSON format
EN Each file is a JSON array of item IDs (strings):
[
"minecraft:diamond",
"minecraft:emerald",
"minecraft:iron_ingot"
]
Buy configuration example
EN Create:
config/ItemMarket/compra/250.json
[
"minecraft:diamond",
"minecraft:netherite_ingot"
]
Result:
- Buying a diamond costs 250
- Buying a netherite_ingot costs 250
Sell configuration example
EN Create:
config/ItemMarket/venta/50.json
[
"minecraft:iron_ingot",
"minecraft:gold_ingot"
]
Result:
- Selling iron_ingot gives 50 per item
- Selling gold_ingot gives 50 per item
What if an item appears in multiple files?
EN Each item can only have one price in memory (maps overwrite by item). If you put the same item in multiple price files, whichever file is loaded last will win ā file ordering may depend on the OS, so donāt rely on it. Keep your lists unique per folder.
What if an item ID is wrong or the mod is missing?
EN
- Invalid IDs are skipped with a log message.
- Items not found in the registry (usually āmissing modā) are skipped.
Do I need to restart to apply changes?
EN
Yes. Prices are loaded at startup by MarketConfig.init(). There is no built-in live reload command yet, so you should:
- Restart the server, or
- Restart the client & rejoin (price sync occurs on join)
Developer API (Java/Fabric API)
ItemMarket provides a Java API intended for other Fabric mods.
EN This is not an HTTP/REST API. You āconnectā by adding ItemMarket as a dependency and calling its classes.
API: Read/Write balance
Class: com.TNTStudios.itemmarket.api.ItemMarketAPI
Methods:
getBalance(ServerPlayerEntity player) -> longaddBalance(ServerPlayerEntity player, long amount) -> longremoveBalance(ServerPlayerEntity player, long amount) -> boolean
EN (Example: Give coins on player join)
import com.TNTStudios.itemmarket.api.ItemMarketAPI;
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
public class MyMod {
public static void init() {
ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> {
var player = handler.getPlayer();
// Give 100 coins on first join (simple example)
ItemMarketAPI.addBalance(player, 100);
});
}
}
Notes (EN)
addBalance()andremoveBalance()will also trigger a UI sync by opening/updating the market screen if the player has it open (viaMarketNetwork.openMarketForPlayer).removeBalance()returnsfalsewhen the player doesnāt have enough funds.
Event: Transaction callback
Interface: com.TNTStudios.itemmarket.api.MarketTransactionCallback
Called only when a transaction succeeds.
Signature:
void onTransaction(ServerPlayerEntity player, Item item, int count, long totalPrice, boolean isBuy);
EN (Example: Log every transaction)
import com.TNTStudios.itemmarket.api.MarketTransactionCallback;
public class MyMod {
public static void init() {
MarketTransactionCallback.EVENT.register((player, item, count, totalPrice, isBuy) -> {
String type = isBuy ? "BUY" : "SELL";
System.out.println("[MyMod] " + player.getName().getString() +
" " + type + " " + count + "x " + item.getName().getString() +
" for " + totalPrice + " coins");
});
}
}
Networking & Security (How it works internally)
EN
- On player join, the server sends:
- all BUY prices
- all SELL prices
to the client (price cache).
- When the player presses M, the client requests the market to open.
- The server responds with the playerās current balance, and the client opens the GUI.
- When the player clicks an item:
- the client sends a transaction request (
buy/sell, item id, sellAll flag) - the server validates everything (price, balance, inventory)
- the server applies changes and then updates the client GUI
- the client sends a transaction request (
EN The server is authoritative, so clients cannot āfakeā prices or balances via packets.
Troubleshooting
EN Market doesnāt open (pressing M does nothing)
- Make sure the mod is installed on the client
- Check keybind conflicts and rebind in Controls
- Ensure Fabric API is installed
Items show but canāt buy/sell
- Check your JSON file names are numeric (e.g.
100.json) - Ensure the item IDs are correct
- Ensure price is >= 1
Some items missing
- The itemās mod may not be installed on the server
- The mod logs āItem not foundā when an ID is missing
Credits & Links
EN
- Developed by TNTStudios
- Website: TNTStudios.space
- Socials: @TNTStudiosn
ItemMarket ā Mercado InāGame para Comprar/Vender Ćtems (Fabric)
ES
ItemMarket agrega un mercado simple y rĆ”pido con GUI dentro del juego para que los jugadores puedan comprar y vender Ćtems usando un balance de monedas guardado por mundo. Los precios se configuran con archivos JSON muy fĆ”ciles, y el mod incluye una API Java/Fabric para que otros mods puedan leer/escribir balances y escuchar transacciones.
CrĆ©ditos: Desarrollado por TNTStudios ā Sitio web: TNTStudios.space ā Redes: @TNTStudiosn
CaracterĆsticas
ES
- ā Mercado con GUI en el cliente (abrir con M por defecto)
- ā Comprar 1 Ćtem por transacción (validación en servidor)
- ā Vender 1 o todo de un Ćtem del inventario
- ā EconomĆa integrada guardada por mundo (PersistentState)
- ā Configuración de precios por JSON (archivo = precio, lista de Ćtems dentro)
- ā Sincronización de precios al entrar
- ā
API pĆŗblica (
ItemMarketAPI) para consultar/sumar/restar monedas - ā
Evento (
MarketTransactionCallback) cuando una transacción es exitosa
Requisitos
ES
- Minecraft: entorno basado en Fabric (cliente + servidor)
- Fabric Loader + Fabric API
- Instalado en servidor y cliente (porque la GUI estĆ” en el cliente y se comunica con el servidor)
Si lo instalas solo en el servidor, los jugadores no tendrƔn la GUI/tecla y no podrƔn usar el mercado.
Instalación
ES
- Instala Fabric Loader y Fabric API para tu versión de Minecraft.
- Coloca el
.jarde ItemMarket en:- Cliente:
mods/ - Servidor:
mods/
- Cliente:
- Inicia el juego/servidor una vez para que se creen las carpetas de configuración.
Cómo usarlo (Jugadores)
ES
- Entra al mundo/servidor.
- Presiona M para abrir el mercado.
- Puedes cambiar la tecla en Opciones ā Controles (busca āItemMarketā).
- Elige:
- Comprar (verde) ā compras usando tus monedas
- Vender (dorado) ā vendes Ćtems del inventario
- DesplĆ”zate por la lista y haz clic en un Ćtem:
- Comprar: confirmar para comprar 1
- Vender: elegir Vender 1 o Vender todo
- Tu balance aparece arriba a la derecha.
¿Qué pasa al comprar?
ES
- El servidor revisa el precio de compra configurado.
- Si tienes monedas suficientes, descuenta y te entrega 1 Ćtem.
¿Qué pasa al vender?
ES
- El servidor revisa el precio de venta configurado.
- Si tienes el Ćtem:
- Vender 1: quita 1 y suma monedas
- Vender todo: quita todas las stacks de ese Ćtem y suma monedas por la cantidad total
EconomĆa (Cómo se guardan las monedas)
ES
- Los balances se guardan en el servidor usando
PersistentState, por mundo. - Clave de guardado:
itemmarket_economy - El dinero se guarda como Long por UUID del jugador.
- Los jugadores nuevos empiezan con 0 monedas a menos que otro mod (o tu código) les agregue monedas con la API.
Configuración de Precios (JSON)
ItemMarket lee precios desde:
config/ItemMarket/compra/
config/ItemMarket/venta/
ES
compra/= precios de COMPRA (pagas monedas para obtener Ćtems)venta/= precios de VENTA (recibes monedas al vender)
Regla de nombres de archivo
ES
Cada .json debe llamarse con un nĆŗmero, y ese nĆŗmero es el precio.
Ejemplos:
config/ItemMarket/compra/100.jsonā precio de compra = 100 monedasconfig/ItemMarket/venta/25.jsonā precio de venta = 25 monedas
Si el nombre no es 100% numƩrico, se ignora.
Importante:
0.jsonexiste, pero no funcionarĆ” en juego porque las transacciones requierenprice > 0. Usa 1+.
Formato del JSON
ES Cada archivo es un arreglo JSON de IDs de Ćtems (strings):
[
"minecraft:diamond",
"minecraft:emerald",
"minecraft:iron_ingot"
]
Ejemplo de compra
ES Crear:
config/ItemMarket/compra/250.json
[
"minecraft:diamond",
"minecraft:netherite_ingot"
]
Resultado:
- Comprar diamond cuesta 250
- Comprar netherite_ingot cuesta 250
Ejemplo de venta
ES Crear:
config/ItemMarket/venta/50.json
[
"minecraft:iron_ingot",
"minecraft:gold_ingot"
]
Resultado:
- Vender iron_ingot da 50 por Ćtem
- Vender gold_ingot da 50 por Ćtem
ĀæQuĆ© pasa si un Ćtem estĆ” en varios archivos?
ES Cada Ćtem solo puede tener un precio en memoria (los mapas sobreescriben por Ćtem). Si repites un Ćtem en varios archivos, āganaā el Ćŗltimo que se cargue ā el orden puede variar por sistema operativo. Mejor no repetir Ćtems.
ĀæY si el ID estĆ” mal o falta un mod?
ES
- IDs invƔlidos se ignoran (con mensaje en logs).
- Ćtems que no existen en el registro (normalmente āfalta el modā) se ignoran.
ĀæDebo reiniciar para aplicar cambios?
ES
SĆ. Los precios se cargan al iniciar con MarketConfig.init(). No hay recarga en vivo por comando (todavĆa), asĆ que:
- Reinicia el servidor, o
- Reinicia el cliente y vuelve a entrar (la sincronización ocurre al entrar)
API para Desarrolladores (Java/Fabric)
ItemMarket incluye una API Java para otros mods Fabric.
ES Esto no es una API HTTP/REST. Te āconectasā agregando ItemMarket como dependencia y llamando sus clases.
API: Leer/Escribir balance
Clase: com.TNTStudios.itemmarket.api.ItemMarketAPI
MƩtodos:
getBalance(ServerPlayerEntity player) -> longaddBalance(ServerPlayerEntity player, long amount) -> longremoveBalance(ServerPlayerEntity player, long amount) -> boolean
ES (Ejemplo: dar monedas al entrar)
import com.TNTStudios.itemmarket.api.ItemMarketAPI;
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
public class MiMod {
public static void init() {
ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> {
var player = handler.getPlayer();
ItemMarketAPI.addBalance(player, 100);
});
}
}
Notas (ES)
addBalance()yremoveBalance()tambiƩn sincronizan la UI abriendo/actualizando la pantalla del mercado cuando corresponde.removeBalance()devuelvefalsesi no hay fondos suficientes.
Evento: Callback de transacción
Interfaz: com.TNTStudios.itemmarket.api.MarketTransactionCallback
Se llama solo si la transacción fue exitosa.
Firma:
void onTransaction(ServerPlayerEntity player, Item item, int count, long totalPrice, boolean isBuy);
ES (Ejemplo: registrar transacciones en consola)
import com.TNTStudios.itemmarket.api.MarketTransactionCallback;
public class MiMod {
public static void init() {
MarketTransactionCallback.EVENT.register((player, item, count, totalPrice, isBuy) -> {
String tipo = isBuy ? "COMPRA" : "VENTA";
System.out.println("[MiMod] " + player.getName().getString() +
" " + tipo + " " + count + "x " + item.getName().getString() +
" por " + totalPrice + " monedas");
});
}
}
Red & Seguridad (Cómo funciona por dentro)
ES
- Al entrar, el servidor envĆa al cliente:
- precios de COMPRA
- precios de VENTA
(cache de precios).
- Al presionar M, el cliente solicita abrir el mercado.
- El servidor responde con el balance, y el cliente abre la GUI.
- Al hacer clic:
- el cliente envĆa la solicitud (
comprar/vender, id del Ćtem, sellAll) - el servidor valida (precio, balance, inventario)
- aplica cambios y actualiza la GUI
- el cliente envĆa la solicitud (
ES El servidor manda, asĆ que el cliente no puede falsificar precios o balances.
Solución de problemas
ES No abre el mercado (M no hace nada)
- Asegúrate que el mod esté instalado en el cliente
- Revisa conflictos de tecla y cƔmbiala en Controles
- Verifica que Fabric API estƩ instalado
Se ven Ćtems pero no deja comprar/vender
- Revisa que los nombres de JSON sean numƩricos (ej.
100.json) - Revisa IDs correctos
- AsegĆŗrate que el precio sea >= 1
Faltan algunos Ćtems
- Puede faltar el mod del Ćtem en el servidor
- El mod imprime āItem no encontradoā en logs cuando falta un ID
CrƩditos & Links
ES
- Desarrollado por TNTStudios
- Sitio web: TNTStudios.space
- Redes: @TNTStudiosn



