Class StorageScreen
java.lang.Object
net.minecraft.client.gui.components.events.AbstractContainerEventHandler
net.minecraft.client.gui.screens.Screen
net.minecraft.client.gui.screens.inventory.AbstractContainerScreen<StorageMenu>
net.ixdarklord.coolcatcore.api.client.gui.screens.StorageScreen
- All Implemented Interfaces:
net.minecraft.client.gui.components.events.ContainerEventHandler,net.minecraft.client.gui.components.events.GuiEventListener,net.minecraft.client.gui.components.Renderable,net.minecraft.client.gui.components.TabOrderedElement,net.minecraft.client.gui.screens.inventory.MenuAccess<StorageMenu>
public class StorageScreen
extends net.minecraft.client.gui.screens.inventory.AbstractContainerScreen<StorageMenu>
A ready screen for any
StorageMenu: a vanilla-style panel sized by its StorageMenuDefinition, a box
behind every slot, and the usual labels, with no texture needed. Register it as is
(MenuScreenRegistry.register(CRATE_MENU, StorageScreen::new)), or extend it to draw more:
public class CrateScreen extends StorageScreen {
public CrateScreen(StorageMenu menu, Inventory inventory, Component title) {
super(menu, inventory, title);
}
@Override
protected void renderLabels(GuiGraphics graphics, int mouseX, int mouseY) {
super.renderLabels(graphics, mouseX, mouseY);
graphics.drawString(this.font, "Uses: " + this.menu.get(CRATE_USES), 100, 6, LABEL_COLOR, false);
}
}
To draw a texture instead, override renderPanel(net.minecraft.client.gui.GuiGraphics, int, int).-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.client.gui.screens.Screen
net.minecraft.client.gui.screens.Screen.NarratableSearchResult -
Field Summary
FieldsFields inherited from class net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
hoveredSlot, imageHeight, imageWidth, INVENTORY_LOCATION, inventoryLabelX, inventoryLabelY, isQuickCrafting, leftPos, menu, playerInventoryTitle, quickCraftSlots, SLOT_ITEM_BLIT_OFFSET, titleLabelX, titleLabelY, topPosFields inherited from class net.minecraft.client.gui.screens.Screen
BACKGROUND_LOCATION, font, height, minecraft, screenExecutor, title, widthFields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS -
Constructor Summary
ConstructorsConstructorDescriptionStorageScreen(StorageMenu menu, net.minecraft.world.entity.player.Inventory inventory, net.minecraft.network.chat.Component title) -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddrawPanel(net.minecraft.client.gui.GuiGraphics graphics, int x, int y, int width, int height) A raised vanilla-style panel.static voiddrawSlot(net.minecraft.client.gui.GuiGraphics graphics, int x, int y) A sunken 18x18 slot box; (x, y) is its top-left corner, one pixel up and left of the item.protected voidpressButton(int id) Presses a button of the menu's definition; its action runs on the server.voidrender(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTick) protected voidrenderBg(net.minecraft.client.gui.GuiGraphics graphics, float partialTick, int mouseX, int mouseY) protected voidrenderPanel(net.minecraft.client.gui.GuiGraphics graphics, int left, int top) Draws the panel and the slot boxes, at the screen's top-left corner.Methods inherited from class net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
checkHotbarKeyPressed, clearDraggingState, containerTick, getMenu, getTooltipFromContainerItem, hasClickedOutside, init, isHovering, isPauseScreen, keyPressed, mouseClicked, mouseDragged, mouseReleased, onClose, removed, renderLabels, renderSlotHighlight, renderTooltip, slotClicked, tickMethods inherited from class net.minecraft.client.gui.screens.Screen
added, addRenderableOnly, addRenderableWidget, addWidget, afterKeyboardAction, afterMouseAction, afterMouseMove, changeFocus, children, clearWidgets, findNarratableWidget, getBackgroundMusic, getNarrationMessage, getRectangle, getTitle, getTooltipFromItem, handleComponentClicked, handleDelayedNarration, hasAltDown, hasControlDown, hasShiftDown, hideWidgets, init, insertText, isCopy, isCut, isMouseOver, isPaste, isSelectAll, isValidCharacterForName, narrationEnabled, onFilesDrop, rebuildWidgets, removeWidget, renderBackground, renderDirtBackground, renderWithTooltip, repositionElements, resize, setInitialFocus, setTooltipForNextRenderPass, setTooltipForNextRenderPass, setTooltipForNextRenderPass, setTooltipForNextRenderPass, shouldCloseOnEsc, shouldNarrateNavigation, triggerImmediateNarration, updateNarratedWidget, updateNarrationState, wrapScreenErrorMethods inherited from class net.minecraft.client.gui.components.events.AbstractContainerEventHandler
getFocused, isDragging, setDragging, setFocusedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.components.events.ContainerEventHandler
charTyped, getChildAt, getCurrentFocusPath, isFocused, keyReleased, magicalSpecialHackyFocus, mouseScrolled, nextFocusPath, setFocusedMethods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
mouseMovedMethods inherited from interface net.minecraft.client.gui.components.TabOrderedElement
getTabOrderGroup
-
Field Details
-
LABEL_COLOR
public static final int LABEL_COLOR- See Also:
-
-
Constructor Details
-
Method Details
-
render
public void render(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTick) - Specified by:
renderin interfacenet.minecraft.client.gui.components.Renderable- Overrides:
renderin classnet.minecraft.client.gui.screens.inventory.AbstractContainerScreen<StorageMenu>
-
renderBg
protected void renderBg(net.minecraft.client.gui.GuiGraphics graphics, float partialTick, int mouseX, int mouseY) - Specified by:
renderBgin classnet.minecraft.client.gui.screens.inventory.AbstractContainerScreen<StorageMenu>
-
renderPanel
protected void renderPanel(net.minecraft.client.gui.GuiGraphics graphics, int left, int top) Draws the panel and the slot boxes, at the screen's top-left corner. -
pressButton
protected void pressButton(int id) Presses a button of the menu's definition; its action runs on the server. -
drawPanel
public static void drawPanel(net.minecraft.client.gui.GuiGraphics graphics, int x, int y, int width, int height) A raised vanilla-style panel. -
drawSlot
public static void drawSlot(net.minecraft.client.gui.GuiGraphics graphics, int x, int y) A sunken 18x18 slot box; (x, y) is its top-left corner, one pixel up and left of the item.
-