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 extractLabels(GuiGraphicsExtractor graphics, int mouseX, int mouseY) {
super.extractLabels(graphics, mouseX, mouseY);
graphics.text(this.font, "Uses: " + this.menu.get(CRATE_USES), 100, 6, LABEL_COLOR, false);
}
}
To draw a texture instead, override extractPanel(GuiGraphicsExtractor, 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
BACKGROUND_TEXTURE_HEIGHT, BACKGROUND_TEXTURE_WIDTH, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH, hoveredSlot, imageHeight, imageWidth, INVENTORY_LOCATION, inventoryLabelX, inventoryLabelY, isQuickCrafting, leftPos, menu, playerInventoryTitle, quickCraftSlots, titleLabelX, titleLabelY, topPosFields inherited from class net.minecraft.client.gui.screens.Screen
FADE_IN_TIME, font, FOOTER_SEPARATOR, HEADER_SEPARATOR, height, INWORLD_FOOTER_SEPARATOR, INWORLD_HEADER_SEPARATOR, MENU_BACKGROUND, minecraft, narratorButton, screenExecutor, title, width -
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.GuiGraphicsExtractor graphics, int x, int y, int width, int height) A raised vanilla-style panel.static voiddrawSlot(net.minecraft.client.gui.GuiGraphicsExtractor 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.voidextractBackground(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int mouseX, int mouseY, float partialTick) protected voidextractPanel(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int left, int top) Draws the panel and the slot boxes, at the screen's top-left corner.protected voidpressButton(int id) Presses a button of the menu's definition; its action runs on the server.Methods inherited from class net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
addItemSlotMouseAction, checkHotbarKeyPressed, clearDraggingState, containerTick, extractCarriedItem, extractContents, extractLabels, extractRenderState, extractSlot, extractSlots, extractSnapbackItem, extractTooltip, getMenu, getTooltipFromContainerItem, handleSlotStateChanged, hasClickedOutside, init, isHovering, isInGameUi, isPauseScreen, keyPressed, mouseClicked, mouseDragged, mouseReleased, mouseScrolled, onClose, removed, slotClicked, tickMethods inherited from class net.minecraft.client.gui.screens.Screen
added, addRenderableOnly, addRenderableWidget, addWidget, afterKeyboardAction, afterMouseAction, afterMouseMove, canInterruptWithAnotherScreen, changeFocus, children, clearFocus, clearWidgets, clickCommandAction, clickUrlAction, defaultHandleClickEvent, defaultHandleGameClickEvent, extractBlurredBackground, extractMenuBackground, extractMenuBackground, extractMenuBackgroundTexture, extractPanorama, extractRenderStateWithTooltipAndSubtitles, extractTransparentBackground, fadeWidgets, fillCrashDetails, findNarratableWidget, getBackgroundMusic, getFont, getNarrationMessage, getRectangle, getTitle, getTooltipFromItem, getUsageNarration, handleDelayedNarration, init, insertText, isAllowedInPortal, isMouseOver, isValidCharacterForName, onFilesDrop, panoramaShouldSpin, rebuildWidgets, removeWidget, repositionElements, resize, setInitialFocus, setInitialFocus, shouldCloseOnEsc, shouldNarrateNavigation, showsActiveEffects, triggerImmediateNarration, updateNarratedWidget, updateNarrationState, updateNarratorStatusMethods inherited from class net.minecraft.client.gui.components.events.AbstractContainerEventHandler
getFocused, isDragging, setDragging, setFocusedMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.components.events.ContainerEventHandler
charTyped, getBorderForArrowNavigation, getChildAt, getCurrentFocusPath, isFocused, keyReleased, nextFocusPath, preeditUpdated, setFocusedMethods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
mouseMoved, shouldTakeFocusAfterInteractionMethods 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
-
extractBackground
public void extractBackground(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int mouseX, int mouseY, float partialTick) - Overrides:
extractBackgroundin classnet.minecraft.client.gui.screens.Screen
-
extractPanel
protected void extractPanel(net.minecraft.client.gui.GuiGraphicsExtractor 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.GuiGraphicsExtractor graphics, int x, int y, int width, int height) A raised vanilla-style panel. -
drawSlot
public static void drawSlot(net.minecraft.client.gui.GuiGraphicsExtractor 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.
-