Skip to content

Item grids & terminals

GaldurItemGrid shows thousands of items with their amounts, like a storage network terminal, without creating real menu slots.

⏱ 6 minGaldur UI 0.1.0Client

Not real slots

A GaldurItemGrid only shows a list of entries and reports clicks. It moves no item and does not talk to the server. Your mod:

  1. keeps the list up to date (from server packets, for instance),
  2. filters and sorts it,
  3. 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.

Create a grid

TerminalScreen.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));

of(columns, rows, entries) creates a grid of columns × rows visible cells, scrollbar included. Each Entry is an ItemStack and a long amount, so amounts can go far past 64.

Put it in a terminal screen

The test mod's terminal places a grid of every item above the player inventory, in a GaldurContainerScreen:

TestTerminalScreen.java
public class TestTerminalScreen extends GaldurContainerScreen<TestTerminalMenu> {    private int scrollRow;    @Override    protected void init() {        super.init();        GaldurItemGrid grid = GaldurItemGrid.of(9, TestTerminalMenu.GRID_ROWS, () -> entries)                .onClick((index, entry, button, shift) -> LOGGER.info("{} x {}", entry.stack(), entry.amount()));        // Grid cells line up with the inventory slots: frame at x - 1.        grid.setPosition(leftPos + 7, topPos + TestTerminalMenu.GRID_Y - 1);        grid.setScrollRow(scrollRow);        addRenderableWidget(grid.onScroll(row -> scrollRow = row));    }}

The matching menu only adds the player inventory, below the grid:

TestTerminalMenu.java
static final int GRID_Y = 18;static final int GRID_ROWS = 6;static final int INVENTORY_Y = GRID_Y + GRID_ROWS * SLOT_SIZE + 14;// in the constructor:addPlayerInventory(inventory, 8, INVENTORY_Y);
Keep the scroll on resize

Minecraft calls init() again on every resize. Save the first visible row with onScroll and restore it with setScrollRow, as above.

What the grid does

Behaviour
RenderingOnly the visible rows are drawn (columns × rows cells), whatever the list size.
AmountsShort form in the cell: "64", "1,2k", "64k" (GaldurFormat.amount).
ScrollingBy whole rows, with the wheel (one row per notch) or the scrollbar, which can be dragged. The scrollbar only shows when the items do not fit.
Hoveraccent_hover outline, accent veil and the item tooltip, with the exact amount above 1,000.
ClickLeft or right, with the Shift state, on an occupied cell.
Disabledactive = false: muted amounts, no click or hover; scrolling still works for browsing.
JEI / EMIHovering an item and pressing R or U shows its recipes (in a GaldurContainerScreen).

A cell is 18 × 18 pixels, like a vanilla slot (CELL_SIZE). The scrollbar width comes from the theme (spacing.scrollbar_width).

A single cell

For one item instead of a grid, GaldurItemSlot is a display cell usable in vanilla layouts:

Example.java
GaldurItemSlot iron = GaldurItemSlot.of(() -> new ItemStack(Items.IRON_INGOT), () -> network.amount(iron))        .onPress(button -> button == 0 ? takeStack() : takeHalf());

The amount is hidden when it is 1, as in vanilla. Left click is 0, right click is 1; Enter and Space count as a left click.

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