The Layout System
Visual design meets clean code. Design your menus like a pro.
Concept
Layouts allow you to define the structure of your inventory using a grid of characters. Instead of manually calculating slot indices (0, 1, 2...), you can simply "draw" your menu in your code.
#########
#.......#
####C####
#.......#
####C####
A typical layout defining a border (#), content area (.), and close button (C).
Implementation
Using the MenuBuilder, you can bind specific MenuButtons to the characters in your layout. The library will automatically calculate the slot indices for you.
MenuBuilder.chest(3)
.layout(
"#########",
"#.......#",
"####C####"
)
.bind('#', MenuPresets.filler(Material.BLACK_STAINED_GLASS_PANE))
.bind('C', MenuPresets.close())
.open(player, Component.text("Example"));
Pro Tip
Characters are case-sensitive. You can use 'A' and 'a' for different groups of items in the same menu! This is extremely useful for complex interfaces with multiple dynamic sections.