▶️ ЗАБЕРИ СВОИ 8 ПОДАРКОВ 🎁 ПРИ СОЗДАНИИ СВОЕГО МАЙНКРАФТ СЕРВЕРА
Моды/Cobbled Market
Cobbled Market

Cobbled Market

Server-side mod for building Item markets with Cobblemon NPCs

Оцените первым
77
1

Cobbled Market

This mod provides a simple, configurable shop system for Cobblemon servers. It allows server owners to define shops in a configuration file, which players can access via Cobblemon NPC Molang functions or the /market command. The mod supports multiple shops, each with its own set of items and prices, and can be easily customized to fit the needs of any server.

Commands

CommandDescriptionDefault permission level
/marketOpens the shop directory (or the shop directly if only one is configured)CHEAT_COMMANDS_AND_COMMAND_BLOCKS
/market <shopId>Opens a specific shop (tab-completes configured shop IDs)CHEAT_COMMANDS_AND_COMMAND_BLOCKS
/market reloadReloads shop definitions from server.tomlALL_COMMANDS
/market debugExtra Debug commands for troubleshooting, or extendingALL_COMMANDS

Permission levels can be changed in config/cobbled_market/permissions.toml:

Available permission nodes:

  • cobbled_market.command.market
  • cobbled_market.command.market.shop
  • cobbled_market.command.market.reload
  • cobbled_market.command.market.debug

Cobblemon NPCs

Molang Functions

The following Molang functions are available for use with Cobblemon NPCs:

  • q.player.market.open() - Opens the shop directory (or the shop directly if only one is configured). Returns 1.0 if successful, 0.0 otherwise.
  • q.player.market.shop(<shopId>) - Opens a specific shop. Returns 1.0 if successful, 0.0 otherwise.

NPC Behaviours

The market_keeper behaviour is provided for use with Cobblemon NPCs. It can be used to create a shopkeeper NPC that opens the shop directory or a specific shop when interacted with.

In your NPC's configuration, add the following:

{
  ...other npc config options...,
  "ai": [
    {
      "type": "apply_behaviours",
      "behaviours": [
        ...other behaviours...,
        "cobbled_market:market_keeper"
      ]
    }
  ]
}

Shops

Shops are defined in the shops list of the per-world config/cobbled_market/server.toml. Menus are generated automatically from this list:

[[server.shops]]
    shopName = "Example Shop"
    shopIcon = "minecraft:chest"
    shopId = "example_shop"
    [[server.shops.entries]]
        itemId = "minecraft:stone"
        price = 10
        quantity = 64
    [[server.shops.entries]]
        itemId = "minecraft:dirt"
        price = 5
        quantity = 64

Dedicated Shop Files

Shops can also be defined in their own TOML files in config/cobbled_market/shops/. Each file must contain a single shop definition, and the filename (without extension) is used as the shop ID. For example, a file named example_shop.toml would define a shop with the ID example_shop.

An example shop file

shopName = "Example Shop"
shopIcon = "minecraft:chest"
    [[entries]]
        itemId = "minecraft:stone"
        price = 10
        quantity = 64
    [[entries]]
        itemId = "minecraft:dirt"
        [[entries.options]]
            price = 1
            quantity = 1
        [[entries.options]]
            price = 15
            quantity = 32
        [[entries.options]]
            price = 30
            quantity = 64

Clicking an item in a shop purchases it immediately using the configured currency provider.

Item strings

itemId and shopIcon use the same item syntax as the vanilla /give command, so items can include data components:

itemId = "cobblemon:poke_ball"
itemId = "minecraft:diamond_sword[custom_name='\"Excalibur\"',enchantments={levels:{'minecraft:sharpness':5}}]"

To get the string for an existing item, hold it and run /market debug main-hand-nbt. Click the output to copy it.

Purchase options

To offer different quantities of the same item at their own prices, replace an entry's quantity and price with an options list:

[[server.shops.entries]]
    itemId = "minecraft:stone"
    [[server.shops.entries.options]]
        quantity = 1
        price = 2
    [[server.shops.entries.options]]
        quantity = 16
        price = 20
    [[server.shops.entries.options]]
        quantity = 64
        price = 60

Each price is the total cost for that option's quantity, not a per-item price. Quantities must be positive integers and prices must be nonnegative integers, both no greater than 2,147,483,647. Zero-price options are supported. The options list must contain at least one choice; do not combine it with top-level quantity or price.

Clicking an entry with options opens a paginated selection menu without charging the player. Clicking a choice purchases that exact quantity at its listed price, and the menu stays open for repeat purchases. The back button returns to the original shop page. Quantities exceeding an item's stack limit are delivered in separate stacks; items that do not fit in the inventory are dropped for the player.

Legacy entries and option-based entries can coexist in the same shop. Entries without options retain their instant-purchase behavior, and even a single explicitly configured option opens the selection menu. Option-count lore, the browse prompt, the selection menu title, and back-to-shop text are configurable under server.menu using shopOptionsLoreLn1, shopOptionsLoreLn2, purchaseOptionsTitle, and navBackToShopText.

Requirements

Supported Economy Providers

Docs

Documentation for this mod can be found at mods.matthiesen.dev

Version Compatibility

Minecraft VersionMatthiesen Core VersionCobblemon VersionMod Version
1.21.11.2.7+1.8.x+1.0.0-beta.1+
1.21.11.3.0+1.8.x+1.0.0-beta.11+
1.21.11.3.5+1.8.x+1.0.0+
1.21.12.0.0+1.8.x+1.1.0+

FastStats Metrics

This mod uses FastStats to collect anonymous usage statistics. This helps the developer understand how this mod is being used and improve it over time. You can learn more about the data collected and how it is used by visiting FastStats: Information.

You can also view the data collected by this mod on the FastStats: Cobbled Market page.

To opt out of this data collection, set the enabled property to false in the <game_directory>/config/faststats/config.properties file.

License

MIT - see LICENSE.

Партнёрский материал

Как поиграть с друзьями с модом Cobbled Market?

Мод Cobbled Market куда интереснее в компании: поднимите сервер Майнкрафт с уже установленным модом, позовите друзей и играйте по своим правилам. Хостинг Майнкрафт для мода Cobbled Market будет готов за пару минут - BungeeHost сделает всё за вас.

Часто задаваемые вопросы

Совместимость

Minecraft: Java Edition

1.21.x

Платформы

Поддерживаемые окружения

Сервер

Зависимости

Ссылки


Детали

Лицензия:
Опубликован:1 месяц назад
Обновлён:6 дней назад
Главная