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

    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

    BACKGROUND_LOCATION, font, height, minecraft, 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
    pressButton(int id)
    Presses a button of the menu's definition; its action runs on the server.
    void
    render(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTick)
     
    protected void
    renderBg(net.minecraft.client.gui.GuiGraphics graphics, float partialTick, int mouseX, int mouseY)
     
    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.

    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, tick

    Methods 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, 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, magicalSpecialHackyFocus, 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

    • render

      public void render(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTick)
      Specified by:
      render in interface net.minecraft.client.gui.components.Renderable
      Overrides:
      render in class net.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:
      renderBg in class net.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.