
Inventory Menu
Inventory Menu is a server side data-driven mod that allows players to create customizable, chest-style menus in Minecraft.
Список изменений
Version 1.2.0
New features
Add action costs. You can now make a menu action charge a player before it runs.
Use it to charge a player for running an action.
Existing menus still work. If an action does not have an action cost, it behaves the same as before.
If one menu item has more than one action, all action_cost checks must pass first. No cost is taken and no action runs unless every action cost can be paid.
- Added
action_costto actions. - Added 3 action cost types: XP, item, and scoreboard.
- Added support for more than one cost on the same action.
- Added
fail_messagefor action costs. - Added
%action_cost%item placeholder. - Added support for Minecraft 26.2.
XP Cost Example
This action costs 3 XP levels before sending the message.
{
"type": "message",
"message": {
"text": "You paid 3 levels."
},
"action_cost": {
"type": "minecraft:xp",
"xp": 3,
"is_level": true
}
}
Use "is_level": false if you want to charge XP points instead of levels.
Item Cost Example
This action costs 2 emeralds.
{
"type": "message",
"message": {
"text": "You paid 2 emeralds."
},
"action_cost": {
"type": "minecraft:item",
"item": {
"id": "minecraft:emerald",
"count": 2
}
}
}
The item must match the item and its data. For example, a named item only matches the same named item.
Score Cost Example
This action costs 5 points from the coins scoreboard objective.
{
"type": "message",
"message": {
"text": "You spent 5 coins."
},
"action_cost": {
"type": "minecraft:score",
"objective": "coins",
"amount": 5
}
}
The scoreboard objective must exist, and the player must have enough score.
Multiple Costs On One Action
You can write one cost or a list of costs.
This action costs 2 XP levels and 5 coins.
{
"type": "message",
"message": {
"text": "You paid both costs."
},
"action_cost": [
{
"type": "minecraft:xp",
"xp": 2,
"is_level": true
},
{
"type": "minecraft:score",
"objective": "coins",
"amount": 5
}
]
}
All costs must be paid before the action runs.
Fail Message Example
Add fail_message inside a cost if you want to tell the player why the action did not run.
"action_cost": {
"type": "minecraft:xp",
"xp": 3,
"is_level": true,
"fail_message": {
"message": {
"text": "You need 3 XP levels.",
"color": "red"
}
}
}
If more than one action has a fail message, each non-empty fail message is sent.
Action Cost Placeholder
Use %action_cost% in item names or lore to show the cost.
Cost: %action_cost%
Use %action_cost:<bullet>% to show one cost per line.
%action_cost:-%
This can show:
- 2 levels
- 5 coins
Multiple Actions Example
In this example, the player must have both 1 diamond and 2 XP levels.
If either cost cannot be paid, nothing runs and nothing is charged.
"action": [
{
"type": "message",
"message": {
"text": "Diamond paid."
},
"action_cost": {
"type": "minecraft:item",
"item": {
"id": "minecraft:diamond",
"count": 1
}
}
},
{
"type": "message",
"message": {
"text": "XP paid."
},
"action_cost": {
"type": "minecraft:xp",
"xp": 2,
"is_level": true
}
}
]
Notes
Teleport actions still keep old cost field.
If a teleport action has both cost and action_cost, both costs are used.
action_costis checked and paid first.- The teleport action then runs.
- The teleport action still checks and pays its own
cost.
Using action_cost for cost control is recommended.
I am planning for version 2.0 which focuses on simplifying the menu JSON, spam prevention and more advanced features.
