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 extractPanel(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

    Fields
    Modifier and Type
    Field
    Description
    static final int
     

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

    Fields inherited from class net.minecraft.client.gui.screens.Screen

    CUBE_MAP, font, FOOTER_SEPARATOR, HEADER_SEPARATOR, height, INWORLD_FOOTER_SEPARATOR, INWORLD_HEADER_SEPARATOR, MENU_BACKGROUND, minecraft, narratorButton, PANORAMA, screenExecutor, title, width

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

    DOUBLE_CLICK_THRESHOLD_MS
  • 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.GuiGraphics graphics, int x, int y, int width, int height)
    A raised vanilla-style panel.
    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.
    protected void
    extractPanel(net.minecraft.client.gui.GuiGraphics 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.
    protected void
    renderBg(net.minecraft.client.gui.GuiGraphics graphics, float partialTick, int mouseX, int mouseY)
     

    Methods inherited from class net.minecraft.client.gui.screens.inventory.AbstractContainerScreen

    checkHotbarKeyPressed, clearDraggingState, containerTick, getMenu, getTooltipFromContainerItem, handleSlotStateChanged, hasClickedOutside, init, isHovering, isPauseScreen, keyPressed, mouseClicked, mouseDragged, mouseReleased, onClose, removed, render, renderBackground, renderLabels, renderSlot, renderSlotHighlight, renderTooltip, slotClicked, tick

    Methods inherited from class net.minecraft.client.gui.screens.Screen

    added, addRenderableOnly, addRenderableWidget, addWidget, afterKeyboardAction, afterMouseAction, afterMouseMove, changeFocus, children, clearFocus, clearTooltipForNextRenderPass, clearWidgets, findNarratableWidget, getBackgroundMusic, getNarrationMessage, getRectangle, getTitle, getTooltipFromItem, getUsageNarration, handleComponentClicked, handleDelayedNarration, hasAltDown, hasControlDown, hasShiftDown, init, insertText, isCopy, isCut, isMouseOver, isPaste, isSelectAll, isValidCharacterForName, onFilesDrop, rebuildWidgets, removeWidget, renderBlurredBackground, renderMenuBackground, renderMenuBackground, renderMenuBackgroundTexture, renderPanorama, renderTransparentBackground, renderWithTooltip, repositionElements, resize, setInitialFocus, setInitialFocus, setTooltipForNextRenderPass, setTooltipForNextRenderPass, setTooltipForNextRenderPass, setTooltipForNextRenderPass, shouldCloseOnEsc, shouldNarrateNavigation, triggerImmediateNarration, updateNarratedWidget, updateNarrationState, updateNarratorStatus, wrapScreenError

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

    getFocused, isDragging, setDragging, setFocused

    Methods inherited from class java.lang.Object

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

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

    charTyped, getChildAt, getCurrentFocusPath, isFocused, keyReleased, mouseScrolled, nextFocusPath, setFocused

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

    mouseMoved

    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

    • renderBg

      protected void renderBg(net.minecraft.client.gui.GuiGraphics graphics, float partialTick, int mouseX, int mouseY)
      Specified by:
      renderBg in class net.minecraft.client.gui.screens.inventory.AbstractContainerScreen<StorageMenu>
    • extractPanel

      protected void extractPanel(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.