Aller au contenu
galdurdocs

GaldurContainerScreen

classclient uniquementdepuis 0.1.0

com.galdurstudio.galdurui.api.screen.GaldurContainerScreen

Pas encore traduit : texte d’origine en anglais.

Themed screen for a slot menu: theme panel, a frame per slot, theme-coloured titles (the screen title in the brand font). Drag and drop, Shift-click, number keys and item tooltips are Minecraft's (AbstractContainerScreen).

Works as is for any menu, vanilla ones included, through factory():

Example.java
// client side, on the mod busevent.register(MY_MENUS.CHEST.get(), GaldurContainerScreen.factory());

The panel size is derived from the slots: the margin left of the first slot is repeated on the right and at the bottom. A menu without slots gets the size of a vanilla chest (176 × 166). A subclass can force its size with GaldurContainerScreen() and override renderBg or renderLabels to add content.

The "Inventory" label sits right above the player inventory when the menu has one, and is hidden otherwise. The hovered slot gets a translucent accent veil and an accent_hover outline, as does every slot targeted by a drag-spread. With JEI or EMI installed, their item list avoids the panel and the getExclusionZones(). The panel rises slightly when the screen opens.

public class GaldurContainerScreen<M extends AbstractContainerMenu> extends AbstractContainerScreen<M>
PAQUETapi.screen
CÔTÉclient uniquement
HÉRITE DEAbstractContainerScreen

Constructeurs 1

GaldurContainerScreen

2 surcharges
public GaldurContainerScreen(M menu, Inventory inventory, Component title)
public GaldurContainerScreen(M menu, Inventory inventory, Component title, int width, int height)

Creates the screen, with a panel sized from the menu slots.

PARAMÈTRES

menuM—
inventoryInventory—
titleComponent—
widthintpanel width in pixels; negative to derive it from the slots
heightintpanel height in pixels; negative to derive it from the slots

Méthodes 8

factory

static
public static <M extends AbstractContainerMenu> MenuScreens.ScreenConstructor<M, GaldurContainerScreen<M>> factory()

RENVOIEMenuScreens.ScreenConstructor<M, GaldurContainerScreen<M>> — a screen constructor for RegisterMenuScreensEvent.register, without a subclass

getExclusionZones

public List<Rect2i> getExclusionZones()

RENVOIEList<Rect2i> — extra screen areas, in screen coordinates, that JEI and EMI must keep clear besides the panel: side tabs, buttons sticking out...

added

public void added()

Starts the opening animation, the first time the screen is shown only.

render

public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick)

While opening, the panel and its contents rise slightly; tooltips stay under the cursor.

PARAMÈTRES

guiGraphicsGuiGraphics—
mouseXint—
mouseYint—
partialTickfloat—

renderBackground

public void renderBackground(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick)

Background dim, then the panel (renderBg). The dim covers the whole screen and does not rise.

PARAMÈTRES

guiGraphicsGuiGraphics—
mouseXint—
mouseYint—
partialTickfloat—

updateNarratedWidget

protected
protected void updateNarratedWidget(NarrationElementOutput narrationElementOutput)

Narrates the hovered slot item ("Iron Ingot, 32"), which Minecraft does not. Nested one level below the widgets so it does not replace the focused one.

PARAMÈTRES

narrationElementOutputNarrationElementOutput—

renderBg

protected
protected void renderBg(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY)

Draws the panel, then a frame for each active slot, outlined when hovered or targeted by a drag-spread. Minecraft draws the items afterwards.

PARAMÈTRES

guiGraphicsGuiGraphics—
partialTickfloat—
mouseXint—
mouseYint—

getSlotColor

public int getSlotColor(int index)

PARAMÈTRES

indexint—

RENVOIEint — the hovered slot veil, drawn by Minecraft over the item: translucent accent

© 2026 Galdur Studio · galdurstudio.com · Discord · LGPL-3.0-onlyProduit non officiel. Non approuvé par Mojang ou Microsoft, ni associé à eux.