GaldurItemGrid
classclient uniquementdepuis 0.1.0com.galdurstudio.galdurui.api.widget.GaldurItemGrid
Pas encore traduit : texte d’origine en anglais.
Themed scrolling item grid, to show thousands of items with their amounts: a storage network's contents, a catalogue, a recipe list...
These are not real menu slots: the grid only shows a list of Entry
and reports clicks. The mod keeps the list up to date (from server packets, for instance),
filters and sorts it, and sends the server what the player wants to do with a click. The list
is read every frame: it can change at any time without rebuilding the
widget.
List<GaldurItemGrid.Entry> contents = ...; // kept up to date by the modGaldurItemGrid grid = GaldurItemGrid.of(9, 6, () -> contents) .onClick((index, entry, button, shift) -> askServer(entry, button, shift));- Rendering: only the visible rows are drawn (columns × rows cells),
whatever the list size. Each cell uses the
slotsprite and the short amount ofGaldurItemSlot("64", "1,2k", "64k"). - Scrolling: by whole rows, with the wheel (one row per notch) or the scrollbar, which can be grabbed and dragged. The scrollbar only shows when the items do not fit.
- Hover:
accent_hoveroutline,accentveil and the item tooltip, with the exact amount above 1,000. - Click: left or right, with the Shift state, on an occupied cell.
- Disabled (
active = false): muted amounts, no click or hover; scrolling still works for browsing. - JEI / EMI: when one is installed, hovering an item and pressing R or U shows its recipes, on any screen.
Sizes from the theme: spacing.scrollbar_width. A cell is 18 × 18 pixels, like a
vanilla slot.
Champs 1
CELL_SIZE
staticSide of a cell, frame included.
Constructeurs 1
GaldurItemGrid
protectedPrefer of().
PARAMÈTRES
Méthodes 7
of
staticPARAMÈTRES
RENVOIEGaldurItemGrid — a grid of columns × rows visible cells, scrollbar included, at
(0, 0) for a layout to place
onClick
Sets the action triggered by a click on an occupied cell. Only one action is kept.
PARAMÈTRES
RENVOIEGaldurItemGrid — this grid, for chaining
onScroll
Sets the action called when the first visible row changes, to keep it when the widget is rebuilt (resize). Only one action is kept.
PARAMÈTRES
RENVOIEGaldurItemGrid — this grid, for chaining
getScrollRow
RENVOIEint — the first visible row
setScrollRow
Scrolls the grid, clamped between the first and the last possible row.
PARAMÈTRES
getEntryAt
PARAMÈTRES
RENVOIEEntry — the item under the mouse, or null
getCellAreaAt
PARAMÈTRES
RENVOIERect2i — the screen-space bounds of the occupied cell under this point, or null
Types imbriqués 2
Entry
An item shown by the grid.
ClickHandler
Action triggered by a click on an occupied cell.