
Что это
This mod is an addon for KubeJS, expanding its functionality in the trading system.
- Тип: мод
- Загрузчик: forge
- Версии Minecraft: 1.20.1 – 1.20.6
- Скачиваний на Modrinth: 35 093
Подробно
This mod is an addon for KubeJS, expanding its functionality in the trading system.
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 // serverscripts 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"), [offer0, offer1] ); } });
The above example lets players trade with pigs, with a fully customizable trading GUI!
And if you need deeper customization — read on.
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 // clientscripts 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..."); } } });
Как установить
Скачайте файл на официальной странице ниже и положите его в папку mods (для модов) или plugins (для плагинов) вашего сервера или клиента. Для модов нужен совместимый загрузчик. Версия должна совпадать с версией Minecraft.
Текст подготовлен автоматически из описания на Modrinth и ждёт проверки редакцией.
Комментарии 0
Комментарии к этому материалу отключены.
Читайте также
Smithing Upgradeable Tools
Make some tools upgradables in the smithing table 05.12.2026
Persistent Mining
Saves block breaking progress so you can continue mining later. 05.12.2026
EnderiumOre
Enderium is a new ore for the end, just as the nether has netherite now the end has Enderium 05.12.2026
Abyssal Shop
This Is A Simple Plugin With A Currency And Shop, Auction House, Sell, Gamble, And Operator Commands Such As /givemoney /setmoney… 05.12.2026
Bed Icons
combines the old bed icons with the new model in one pack 05.12.2026
Depiglining
Reverts speedrunning nerfs from 1.16.2+ like Piglin Brutes and bartering 05.12.2026