Moxvallix's GUI Library | Graphical Interface Tool for Minecraft Datapacks
Simplified GUI Creation for Datapacks
This Datapack greatly streamlines graphical interface development for Minecraft. The system operates on a data-driven principle: interfaces are automatically generated based on templates stored in the game's data storage.
Two Operating Modes
"Enderchest" Mode: The interface displays directly in the player's Ender Chest. Perfect solution for adventure maps - works straightforward and requires no additional blocks.
"Barrel" Mode: GUI renders in a container block at your coordinates. Recommended to use Barrels - they allow detecting if the container is opened, preventing simultaneous interface usage by multiple players.
Getting Started
Choose interface type: "barrel" or "enderchest". Then use <type> in commands, replacing it with your selected type.
Core Functions:
gui:api/<type>/render- creates interface by page IDgui:api/<type>/watch- handles GUI interactions
The watch function should run on loop while the graphical interface is active.
Creating Index
Custom GUIs require configuring an index function - determines which interface template to use based on player's gui.page score value.
Index Example:
execute if score @s gui.page matches 1 run function modrif:gui/main_menu
execute if score @s gui.page matches 2 run function modrif:gui/settings
execute if score @s gui.page matches 3 run function modrif:gui/store
Register your function by adding it to the gui:index tag.
Designing GUI Templates
Menu Template Example:
data modify storage gui:page template set value [\n {slot:12b, page:2s, item:{id:"minecraft:experimental"}},\n {slot:14b, page:3s, item:{id:"minecraft:space_item"}}\n]
This template places 2 objects:
- Position 12 - "Test Item" calls the settings page
- Position 14 - "Space Analyzer" switches to catalog display
Advanced Interaction
For creating dynamic menus you can modify slots through gui:render/slot tags (reading slot data) and gui:render/item (modifying items).
Customize click actions via specialized extension points gui:select/slot as per your needs.