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

    Fields
    Modifier and Type
    Field
    Description
    static final int
     

    Fields 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, topPos

    Fields 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

    Constructors
    Constructor
    Description
    StorageScreen(StorageMenu menu, net.minecraft.world.entity.player.Inventory inventory, net.minecraft.network.chat.Component title)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    drawPanel(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int x, int y, int width, int height)
    A raised vanilla-style panel.
    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.
    void
    extractBackground(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int mouseX, int mouseY, float partialTick)
     
    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.
    protected void
    pressButton(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, containerTick, extractCarriedItem, extractContents, extractLabels, extractRenderState, extractSlot, extractSlots, extractTooltip, getMenu, getTooltipFromContainerItem, handleSlotStateChanged, hasClickedOutside, init, isHovering, isInGameUi, isPauseScreen, keyPressed, mouseClicked, mouseDragged, mouseReleased, mouseScrolled, onClose, onMouseClickAction, removed, slotClicked, tick

    Methods 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, rebuildWidgets, removeWidget, repositionElements, resize, setInitialFocus, setInitialFocus, shouldCloseOnEsc, shouldNarrateNavigation, showsActiveEffects, triggerImmediateNarration, updateNarratedWidget, updateNarrationState, updateNarratorStatus

    Methods inherited from class net.minecraft.client.gui.components.events.AbstractContainerEventHandler

    getFocused, isDragging, setDragging, setFocused

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.minecraft.client.gui.components.events.ContainerEventHandler

    charTyped, getBorderForArrowNavigation, getChildAt, getCurrentFocusPath, isFocused, keyReleased, nextFocusPath, preeditUpdated, setFocused

    Methods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener

    mouseMoved, shouldTakeFocusAfterInteraction

    Methods inherited from interface net.minecraft.client.gui.components.TabOrderedElement

    getTabOrderGroup
  • Field Details

  • Constructor Details

    • StorageScreen

      public StorageScreen(StorageMenu menu, net.minecraft.world.entity.player.Inventory inventory, net.minecraft.network.chat.Component title)
  • Method Details

    • extractBackground

      public void extractBackground(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int mouseX, int mouseY, float partialTick)
      Overrides:
      extractBackground in class net.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.