Skip to content

GaldurItemGrid

classclient onlysince 1.0.0

com.galdurstudio.galdurui.api.widget.GaldurItemGrid

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.

Example.java
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 slot sprite and the short amount of GaldurItemSlot ("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_hover outline, accent veil 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.

public class GaldurItemGrid extends AbstractWidget
PACKAGEapi.widget
SIDEclient only
EXTENDSAbstractWidget

Fields 1

CELL_SIZE

static
public static final int CELL_SIZE

Side of a cell, frame included.

Constructors 1

GaldurItemGrid

protected
protected GaldurItemGrid(int columns, int rows, Supplier<List<Entry>> entries)

Prefer of().

PARAMETERS

columnsintnumber of columns (at least 1)
rowsintnumber of visible rows (at least 1)
entriesSupplier<List<Entry>>supplier of the item list, called every frame

Methods 7

of

static
public static GaldurItemGrid of(int columns, int rows, Supplier<List<Entry>> entries)

PARAMETERS

columnsintnumber of columns (at least 1)
rowsintnumber of visible rows (at least 1)
entriesSupplier<List<Entry>>supplier of the item list, called every frame

RETURNSGaldurItemGrid — a grid of columns × rows visible cells, scrollbar included, at (0, 0) for a layout to place

onClick

public GaldurItemGrid onClick(ClickHandler onClick)

Sets the action triggered by a click on an occupied cell. Only one action is kept.

PARAMETERS

onClickClickHandlerreceives the index, the item, the button and the Shift state

RETURNSGaldurItemGrid — this grid, for chaining

onScroll

public GaldurItemGrid onScroll(IntConsumer 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.

PARAMETERS

onScrollIntConsumerreceives the new first visible row

RETURNSGaldurItemGrid — this grid, for chaining

getScrollRow

public int getScrollRow()

RETURNSint — the first visible row

setScrollRow

public void setScrollRow(int row)

Scrolls the grid, clamped between the first and the last possible row.

PARAMETERS

rowintthe first row to show

getEntryAt

public Entry getEntryAt(double mouseX, double mouseY)

PARAMETERS

mouseXdoublemouse x
mouseYdoublemouse y

RETURNSEntry — the item under the mouse, or null

getCellAreaAt

public Rect2i getCellAreaAt(double mouseX, double mouseY)

PARAMETERS

mouseXdoublemouse x
mouseYdoublemouse y

RETURNSRect2i — the screen-space bounds of the occupied cell under this point, or null

Nested types 2

Entry

public record Entry(ItemStack stack, long amount)

An item shown by the grid.

ClickHandler

public interface ClickHandler

Action triggered by a click on an occupied cell.

© 2026 Galdur Studio · galdurstudio.com · Discord · LGPL-3.0-onlyNot an official Minecraft product. Not approved by or associated with Mojang or Microsoft.