Skip to main content

Design a Backpack Menu

Every backpack type can have a menu of its own: title, size, colours, icons, and the position, name and lore of every button. It is all set in the optional gui section of the type in config.yml. Anything left out keeps the default.

Changes apply as soon as config.yml is saved (or after /backpack admin reload with auto-reload: false): reopen the backpack to see them.

How a menu is built​

A menu has up to six rows of nine slots, numbered from 0 (top left) to 53 (bottom right of six rows). A slot can also be written as row, column counted from 0: 0, 0 is the top left, 5, 8 the bottom right of six rows.

Each slot holds one of three things:

  • a button (sort, auto-pickup, the page arrows and so on), in the slot you give it;
  • the filler, a decoration that holds nothing;
  • the backpack: every slot that is neither a button nor filler shows the backpack's items.

Without filler.slots, the filler takes the rest of every row holding a button, so a row of buttons stays a row of buttons. List the filler's slots yourself to put buttons among the items, and hide every button with enabled: false (and filler.slots: []) to have nothing but items.

KeyMeaning
titleMenu title (MiniMessage, %type% is the type's display name). Without it, gui-backpack-title from messages.yml
rows2 to 6, or auto to fit the capacity (9 slots and one row of buttons give 2 rows, 27 give 4). A page holds every slot that is neither a button nor filler, and a backpack bigger than one page gets more pages. Default 6
fillerThe item in the slots that hold neither a button nor the backpack. Menu items take the keys of any Utilizer item config: material, name, lore, custom-model-data, glow and more. material: AIR leaves the filler slots empty
filler.slotsThe filler's slots, as numbers or "row, column" in quotes, e.g. [48, "5, 4"]. Without it, the rest of every row holding a button; [] for none
locked-slotThe item filling the slots past the capacity, same keys. Its text comes from gui-locked-slot in messages.yml unless set here. material: AIR leaves those slots empty
buttonsThe six buttons below, each with enabled, slot and the item keys

Button keys​

KeyMeaning
enabledfalse hides the button. Default true
slotThe slot of the menu, a number or row, column. A section with row and column works too, as in Utilizer menus. Without it, the button's default column in the bottom row
materialThe icon
custom-model-dataFor resource pack icons
name, loreReplace the button's text from messages.yml for this type only, with the same placeholders
material-off, custom-model-data-offauto-pickup only: the icon shown while auto-pickup is off

The buttons, with their default column in the bottom row (0 is the left), icon and the placeholders their text can use:

ButtonColumnIconText in messages.ymlPlaceholders
previous-page0ARROWgui-previous-page%current%, %total%
page-info1PAPERgui-page-info%current%, %total%, %used%, %capacity%
sort2HOPPERgui-sort-button
auto-pickup4LIME_DYE, off RED_DYEgui-auto-pickup-button%status%
quick-deposit6CHESTgui-quick-deposit-button
next-page8ARROWgui-next-page%current%, %total%

The page buttons only show when there is a page to turn to, so a one-page backpack shows the filler there. The locked slot can use %capacity%.

Examples​

A gold menu with the buttons in the middle​

Four rows, and renamed buttons in the middle of the bottom row:

  royal:
display-name: "<gold><bold>Royal Treasury</bold></gold>"
material: GOLD_INGOT
slots: 54
gui:
title: "<gradient:#FFD700:#FFA500><bold>♛ Royal Treasury ♛</bold></gradient>"
rows: 4 # 27 slots a page, so two pages
filler:
material: PURPLE_STAINED_GLASS_PANE
buttons:
sort:
slot: 3, 3 # row 3, column 3 counted from 0: the same as slot 30
material: GOLD_INGOT
name: "<gold><bold>Arrange the Treasure</bold></gold>"
lore:
- ""
- "<gray>Puts every item in its place.</gray>"
page-info:
slot: 3, 4
material: WRITABLE_BOOK
name: "<gold><bold>Royal Ledger</bold></gold>"
lore:
- ""
- "<gray>Vault</gray> <white>%current%/%total%</white>"
- "<gray>Treasures</gray> <white>%used%/%capacity%</white>"
auto-pickup:
slot: 3, 5
material: SUNFLOWER
material-off: WITHER_ROSE
quick-deposit:
enabled: false

Page arrows at the sides​

The arrows at the ends of the third row with items between them, and the other buttons in the bottom row:

  satchel:
# ...
slots: 68 # 34 slots a page, so two pages
gui:
rows: 5
filler:
material: GRAY_STAINED_GLASS_PANE
slots: ["4, 0", 37, 39, 41, 43]
buttons:
previous-page:
slot: 2, 0
next-page:
slot: 2, 8
sort:
slot: 4, 2
page-info:
slot: 4, 4
auto-pickup:
slot: 4, 6
quick-deposit:
slot: 4, 8

Buttons on top, and renamed locked slots​

  small:
# ...
gui:
rows: auto # 2 rows for 9 slots: the buttons, then the items
filler:
material: LIME_STAINED_GLASS_PANE
buttons:
previous-page:
enabled: false # one page, nothing to turn
next-page:
enabled: false
page-info:
slot: 0
sort:
slot: 3
quick-deposit:
slot: 4
material: BARREL
auto-pickup:
slot: 5
scout:
# ...
slots: 20 # rows: auto gives 4 rows, so 7 slots are locked
gui:
rows: auto
locked-slot:
material: BROWN_STAINED_GLASS_PANE
name: "<red>Sealed</red>"
lore:
- "<gray>This pack holds %capacity% slots.</gray>"

A menu drawn by a resource pack​

A resource pack can draw the whole menu as a background image, with custom fonts in the title. The glass panes then get in the way. Set the filler and the locked slots to material: AIR to leave those slots empty, and give the buttons custom-model-data for the pack's icons:

    gui:
title: "<white></white>" # the pack's background glyph
rows: 6
filler:
material: AIR
locked-slot:
material: AIR
buttons:
sort:
material: PAPER
custom-model-data: 1001

Empty filler and locked slots still never hold an item: clicks on them do nothing, and a shift-click from the player's inventory fills the backpack's slots on the shown page, topping up similar stacks first, then the first empty slot, and leaves what does not fit with the player.

A button cannot be AIR, since an empty slot cannot be clicked: it shows its default icon, with a warning in the console. Hide it with enabled: false instead.

rows: auto​

With rows: auto the menu grows and shrinks with the capacity: rows holding a button or the filler at the very top stay at the top, the others stay at the bottom, and the rows of items in between change. Changing a type's slots in the admin GUI then never moves its buttons into the middle of the menu.

When settings clash​

  • When two buttons share a slot, one with a slot of its own wins over one left at its default; when both set it, the first in the button table above wins. The other is hidden, with a warning in the console: give it a slot of its own or enabled: false.
  • A filler slot that a button also takes shows the button.
  • Bad values (an unknown material, rows or a slot out of range) are reported in the console and fall back to the default, so the backpack always opens.

A new install comes with a menu of its own for each of the default types: its own title, colours and icons, with the button text still coming from messages.yml.

  • From 1.0.4 or earlier: on the first start after updating, every type in config.yml gets a gui section holding its current look, so nothing changes until you edit it. The previous file is kept as config.yml.v1.bak.
  • Up to 1.1.0, a button's slot was its column in the bottom row (0 to 8). On the first start after updating, each one becomes the matching slot of the menu, so the menu looks the same, every button gets enabled: true written out, and filler.slots lists the slots the filler had. auto-reload: true is added too. Menu items named with display-name get name instead. The previous file is kept as config.yml.v2.bak.

config-version in config.yml makes sure each of these happens only once. A config-version newer than the plugin knows is left as it is, with a warning in the console.