### New Features
#### Empty Slot Filler (`fill`)
You can now define an optional `fill` item in menu layouts. Empty slots that are not assigned to any item will be filled automatically with this item stack.
```json
{
"name": "My Menu",
"rows": 3,
"fill": {
"id": "minecraft:gray_stained_glass_pane",
"components": {
"minecraft:custom_name": " "
}
},
"items": []
}
```
#### Menu Close Policy (`close_container`)
You can now specify whether and when clicking an item should close the menu using `close_container`:
- `"default"`: Default menu closing behavior.
- `"on_success"` (or `true`): Closes the menu only when all actions succeed.
- `"on_failure"`: Closes the menu if conditions or action costs fail.
- `"always"`: Always closes the menu on click.
- `"never"` (or `false`): Keeps the menu open regardless of success or failure.
```json
{
"slot": [1, 5],
"close_container": "on_success",
"item": {
"type": "custom",
"id": "minecraft:compass"
}
}
```
#### Non-Closing Item Condition Checks
- If a player fails an item predicate check (`condition`), they receive the failure message without having the entire menu force-closed. Menu-level conditions still close unauthorized menus.
#### Safe Player Teleportation
- Teleporting to another player now checks if the destination position is safe (`safe_check`), preventing teleportation into void, lava, or suffocation blocks.
### Fixes & Improvements
#### Exploits & Spam Protection
- **Click Spam & Autoclicker Prevention:** Added a 0.1-second delay between menu clicks to stop players from spamming buttons or using autoclickers.
- **Fair Cost Charging on Multiple Actions:** If a button runs multiple actions with costs, the total combined cost (items, XP, or scoreboard points) is checked before taking anything, preventing players from cheating multi-step actions.
- **Fixed Shift-Click Glitches:** Blocked shift-clicking inside menus to prevent item duplication bugs and inventory glitches.
- **No Negative Scoreboards:** Scoreboard points can no longer drop below zero when paying for an action.
#### Crash Fixes & Safety
- **Infinite Loop Protection:** If custom items accidentally reference each other in a loop, the mod now safely catches the error instead of crashing the server.
- **Safer Identifier Handling:** Typos or invalid item/menu names in configs, entity tags, or item data will now log a warning instead of crashing the game.
- **Safer Teleports:** Teleporting to offline players, unloaded areas, or missing worlds now shows a clean error message instead of causing a crash.
- **Advancement Display Safety:** Viewing advancements in menus will no longer accidentally alter original game advancement icons.
#### Performance & Memory
- **No More Server Reload Leaks:** Fixed memory leaks where reloading the server would leave behind old event handlers and use up RAM.
- **Cleaner Player Data:** Menus now properly clean up player data as soon as a menu is closed or a player disconnects.
- **Reduced Teleport Lag:** Safety checks before teleporting no longer force the server to load distant chunks instantly, eliminating lag spikes.
- **Faster Menus & Placeholders:** Menu items and placeholders now load and refresh faster and more efficiently.
- **Auto-Created Config Folder:** The `config/` directory is now created automatically if it doesn't already exist.
Developer information
Projects on Modrinth are automatically available through a Maven repository for use with JVM build tools such as Gradle.
maven { name = "Modrinth"; url = "https://api.modrinth.com/maven" }