MerchantJS

⭐ — (1 endorsements) 📥 22,794 downloads 📌 v1.0.0 📅 10/30/2025
🟡 Updated this year

By MerrySnow · economy

⬇ Download Mod Source: Modrinth ↗ 📅 Updated: 10/26/2025 📅 Created: 10/30/2025
⚠️ Install Order · 2 steps
1🛠️ Forge — Minecraft Forge (mod loader) Download ↗
2🛠️ Fabric — Fabric Loader Download ↗

Install in this order, then this mod last — most mods fail to load without their framework and dependencies in place.

🔍 Analysis

  • 👍 0.0% endorsement rate
  • 🏆 #14 of 21 economy mods in this game by downloads

📋 About This Mod

## MerchantJS This mod is an addon for **KubeJS**, expanding its functionality in the **trading system**. ### Create Custom Trades Anywhere This mod allows you to initiate trades *anywhere* — trade with pigs, with End Stone, with Enchanted Golden Apples, or even out of thin air! ```javascript // server_scripts ItemEvents.entityInteracted(event => { // Check if the interacted entity is a pig if (event.getTarget().type === "minecraft:pig") { // Create a complete trade offer let offer0 = MerchantJSUtils.createMerchantOffer({ buy: Item.of("minecraft:potato").toNBT(), buyB: Item.of("minecraft:bread").toNBT(), sell: Item.of("minecraft:stone").toNBT(), uses: 0, maxUses: 50, xp: 5, priceMultiplier: 0, demand: 0 }); // Create a simple trade offer let offer1 = MerchantJSUtils.createMerchantOffer({ buy: Item.of("minecraft:beef").toNBT(), sell: Item.of("minecraft:egg").toNBT() }); // Open a custom trading GUI with the given player, title, and offers MerchantJSUtils.openMerchant( event.player, Component.translatable("Little Piggy’s Cartoon House"), ); } }); ``` The above example lets players **trade with pigs**, with a fully customizable trading GUI! And if you need deeper customization — read on. --- ### Selective Trade Availability Let’s first explain the meaning of each parameter: ```javascript let offer0 = MerchantJSUtils.createMerchantOffer({ buy: Item.of("minecraft:potato").toNBT(), // Input item A (required) buyB: Item.of("minecraft:bread").toNBT(), // Input item B (optional, defaults to empty) sell: Item.of("minecraft:stone").toNBT(), // Output item (required) uses: 0, // Number of times used (optional, default 0) maxUses: 50, // Maximum uses (optional, default 99) xp: 5, // Experience reward (optional, default 0) priceMultiplier: 0, // Price fluctuation multiplier (optional, default 0) demand: 0 // Initial demand value (optional, default 0) }); ``` Setting `maxUses` to `0` will make the trade appear **unavailable**. Now combine it with this event for dynamic trade control: ```javascript // client_scripts MerchantEvents.switchTrade(event => { if (event.titleKey == "Little Piggy’s Cartoon House") { // Check if it’s the pig’s trading window (works with vanilla ones too!) if (event.getOffer().getMaxUses() == 0) { Client.player.tell("This trade is locked..."); } } }); ``` With this, you can **selectively enable or disable trades**, which is perfect for stage-based gameplay or progression systems. --- ### Vanilla Trade Compatibility Vanilla trading already has many mechanics. MerchantJS mainly focuses on **creating additional trades easily**. For features like restocking, experience, demand, or price fluctuation — you’ll need to handle those yourself. At minimum, you’ll need a place to store trade-related data (like inventory or stock info), since each call to `openMerchant` defines the offers anew. Fortunately, **KubeJS’s `persistentData`** works great for this. Then, all that’s left is triggering data refresh when needed. ```javascript // server_scripts MerchantEvents.afterTrade(event => { event.player.tell(`Thank you for purchasing ${event.getOffer().result.id}! Come again soon!`); event.player.addXP(event.getOffer().xp); }); ``` This event fires after any trade occurs — and works for vanilla trades too! If you want to trigger additional actions after trading, this is the place to do it. As for restocking — just check the time interval whenever you open the trade window. --- ### Future Plans None for now — but feel free to make a wish!

## MerchantJS

This mod is an addon for KubeJS, expanding its functionality in the trading system.

### Create Custom Trades Anywhere

This mod allows you to initiate trades anywhere — trade with pigs, with End Stone, with Enchanted Golden Apples, or even out of thin air!

```javascript // server_scripts ItemEvents.entityInteracted(event => { // Check if the interacted entity is a pig if (event.getTarget().type === "minecraft:pig") { // Create a complete trade offer let offer0 = MerchantJSUtils.createMerchantOffer({ buy: Item.of("minecraft:potato").toNBT(), buyB: Item.of("minecraft:bread").toNBT(), sell: Item.of("minecraft:stone").toNBT(), uses: 0, maxUses: 50, xp: 5, priceMultiplier: 0, demand: 0 }); // Create a simple trade offer let offer1 = MerchantJSUtils.createMerchantOffer({ buy: Item.of("minecraft:beef").toNBT(), sell: Item.of("minecraft:egg").toNBT() }); // Open a custom trading GUI with the given player, title, and offers MerchantJSUtils.openMerchant( event.player, Component.translatable("Little Piggy’s Cartoon House"), ); } }); ```

The above example lets players trade with pigs, with a fully customizable trading GUI!

And if you need deeper customization — read on.

### Selective Trade Availability

Let’s first explain the meaning of each parameter:

```javascript let offer0 = MerchantJSUtils.createMerchantOffer({ buy: Item.of("minecraft:potato").toNBT(), // Input item A (required) buyB: Item.of("minecraft:bread").toNBT(), // Input item B (optional, defaults to empty) sell: Item.of("minecraft:stone").toNBT(), // Output item (required) uses: 0, // Number of times used (optional, default 0) maxUses: 50, // Maximum uses (optional, default 99) xp: 5, // Experience reward (optional, default 0) priceMultiplier: 0, // Price fluctuation multiplier (optional, default 0) demand: 0 // Initial demand value (optional, default 0) }); ```

Setting `maxUses` to `0` will make the trade appear unavailable.

Now combine it with this event for dynamic trade control:

```javascript // client_scripts MerchantEvents.switchTrade(event => { if (event.titleKey == "Little Piggy’s Cartoon House") { // Check if it’s the pig’s trading window (works with vanilla ones too!) if (event.getOffer().getMaxUses() == 0) { Client.player.tell("This trade is locked..."); } } }); ```

With this, you can selectively enable or disable trades, which is perfect for stage-based gameplay or progression systems.

### Vanilla Trade Compatibility

Vanilla trading already has many mechanics. MerchantJS mainly focuses on creating additional trades easily. For features like restocking, experience, demand, or price fluctuation — you’ll need to handle those yourself.

At minimum, you’ll need a place to store trade-related data (like inventory or stock info), since each call to `openMerchant` defines the offers anew.

Fortunately, KubeJS’s `persistentData` works great for this. Then, all that’s left is triggering data refresh when needed.

```javascript // server_scripts MerchantEvents.afterTrade(event => { event.player.tell(`Thank you for purchasing ${event.getOffer().result.id}! Come again soon!`); event.player.addXP(event.getOffer().xp); }); ```

This event fires after any trade occurs — and works for vanilla trades too! If you want to trigger additional actions after trading, this is the place to do it.

As for restocking — just check the time interval whenever you open the trade window.

### Future Plans

None for now — but feel free to make a wish!

🤖 AI-enhanced — based on mod data

📊 Mod Details

Game
Minecraft Mods
Author
MerrySnow
Version
1.0.0
Downloads
22,794
Endorsements
1
Category
economy
Created
10/30/2025
Updated
10/26/2025
Game Versions
1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5
Tags
economy, utility

🔧 How to Install Minecraft Mods Mods

Download from Modrinth. Use Prism Launcher or drop into your mods folder.

📖 Full step-by-step install guide for Minecraft Mods →

Visit the official mod page for specific installation instructions for this mod.

🎮 Need cheat codes or console commands? Check ur gaming wiki for Minecraft Mods commands, item IDs, and more.

❓ Frequently Asked Questions

Which Minecraft Mods versions does MerchantJS support?

The author lists 1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6. Other versions may work but are untested by the author.

What is the latest version of MerchantJS?

Version 1.0.0, published 2025-10-26 with 22,794 downloads recorded at the source.

Keep browsing — more Minecraft Mods mods await

📋 All Minecraft Mods Mods 🏆 Top 25 📂 More economy 👤 More by MerrySnow 🔎 Similar Mods 🌐 Best economy (All Games) 🔀 Check Compatibility ⚖️ Compare Mods 🆕 New Mods