Class AbstractContainerScreen<T extends AbstractContainerMenu>

All Implemented Interfaces:
ContainerEventHandler, GuiEventListener, Renderable, TabOrderedElement, MenuAccess<T>
Direct Known Subclasses:
AbstractMountInventoryScreen, AbstractRecipeBookScreen, BeaconScreen, BrewingStandScreen, CartographyTableScreen, ContainerScreen, CrafterScreen, CreativeModeInventoryScreen, DispenserScreen, EnchantmentScreen, GrindstoneScreen, HopperScreen, ItemCombinerScreen, LoomScreen, MerchantScreen, ShulkerBoxScreen, StonecutterScreen

public abstract class AbstractContainerScreen<T extends AbstractContainerMenu> extends Screen implements MenuAccess<T>
  • Field Details

    • INVENTORY_LOCATION

      public static final Identifier INVENTORY_LOCATION
    • SLOT_HIGHLIGHT_BACK_SPRITE

      private static final Identifier SLOT_HIGHLIGHT_BACK_SPRITE
    • SLOT_HIGHLIGHT_FRONT_SPRITE

      private static final Identifier SLOT_HIGHLIGHT_FRONT_SPRITE
    • BACKGROUND_TEXTURE_WIDTH

      protected static final int BACKGROUND_TEXTURE_WIDTH
      See Also:
    • BACKGROUND_TEXTURE_HEIGHT

      protected static final int BACKGROUND_TEXTURE_HEIGHT
      See Also:
    • SNAPBACK_SPEED

      private static final float SNAPBACK_SPEED
      See Also:
    • QUICKDROP_DELAY

      private static final int QUICKDROP_DELAY
      See Also:
    • DEFAULT_IMAGE_WIDTH

      protected static final int DEFAULT_IMAGE_WIDTH
      See Also:
    • DEFAULT_IMAGE_HEIGHT

      protected static final int DEFAULT_IMAGE_HEIGHT
      See Also:
    • imageWidth

      protected final int imageWidth
    • imageHeight

      protected final int imageHeight
    • titleLabelX

      protected int titleLabelX
    • titleLabelY

      protected int titleLabelY
    • inventoryLabelX

      protected int inventoryLabelX
    • inventoryLabelY

      protected int inventoryLabelY
    • itemSlotMouseActions

      private final List<ItemSlotMouseAction> itemSlotMouseActions
    • playerInventoryTitle

      protected final Component playerInventoryTitle
    • hoveredSlot

      protected @Nullable Slot hoveredSlot
    • clickedSlot

      private @Nullable Slot clickedSlot
    • quickdropSlot

      private @Nullable Slot quickdropSlot
    • lastClickSlot

      private @Nullable Slot lastClickSlot
    • snapbackData

      private @Nullable AbstractContainerScreen.SnapbackData snapbackData
    • leftPos

      protected int leftPos
    • topPos

      protected int topPos
    • isSplittingStack

      private boolean isSplittingStack
    • draggingItem

      private ItemStack draggingItem
    • quickdropTime

      private long quickdropTime
    • quickCraftSlots

      protected final Set<Slot> quickCraftSlots
    • isQuickCrafting

      protected boolean isQuickCrafting
    • quickCraftingType

      private int quickCraftingType
    • quickCraftingButton

      private int quickCraftingButton
    • skipNextRelease

      private boolean skipNextRelease
    • quickCraftingRemainder

      private int quickCraftingRemainder
    • doubleclick

      private boolean doubleclick
    • lastQuickMoved

      private ItemStack lastQuickMoved
    • slotColor

      protected int slotColor
  • Constructor Details

    • AbstractContainerScreen

      public AbstractContainerScreen(T menu, Inventory inventory, Component title)
    • AbstractContainerScreen

      public AbstractContainerScreen(T menu, Inventory inventory, Component title, int imageWidth, int imageHeight)
  • Method Details

    • init

      protected void init()
      Overrides:
      init in class Screen
    • addItemSlotMouseAction

      protected void addItemSlotMouseAction(ItemSlotMouseAction itemSlotMouseAction)
    • extractRenderState

      public void extractRenderState(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a)
      Specified by:
      extractRenderState in interface Renderable
      Overrides:
      extractRenderState in class Screen
    • extractContents

      public void extractContents(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a)
    • extractCarriedItem

      public void extractCarriedItem(GuiGraphicsExtractor graphics, int mouseX, int mouseY)
    • extractSnapbackItem

      public void extractSnapbackItem(GuiGraphicsExtractor graphics)
    • extractSlots

      protected void extractSlots(GuiGraphicsExtractor graphics, int mouseX, int mouseY)
    • mouseScrolled

      public boolean mouseScrolled(double x, double y, double scrollX, double scrollY)
      Specified by:
      mouseScrolled in interface ContainerEventHandler
      Specified by:
      mouseScrolled in interface GuiEventListener
    • extractSlotHighlightBack

      private void extractSlotHighlightBack(GuiGraphicsExtractor graphics)
    • extractSlotHighlightFront

      private void extractSlotHighlightFront(GuiGraphicsExtractor graphics)
    • extractTooltip

      protected void extractTooltip(GuiGraphicsExtractor graphics, int mouseX, int mouseY)
    • showTooltipWithItemInHand

      private boolean showTooltipWithItemInHand(ItemStack item)
    • getTooltipFromContainerItem

      protected List<Component> getTooltipFromContainerItem(ItemStack itemStack)
    • extractFloatingItem

      private void extractFloatingItem(GuiGraphicsExtractor graphics, ItemStack carried, int x, int y, @Nullable String itemCount)
    • extractLabels

      protected void extractLabels(GuiGraphicsExtractor graphics, int xm, int ym)
    • extractSlot

      protected void extractSlot(GuiGraphicsExtractor graphics, Slot slot, int mouseX, int mouseY)
    • renderSlotContents

      protected void renderSlotContents(GuiGraphicsExtractor graphics, ItemStack itemStack, Slot slot, @Nullable String itemCount)
    • recalculateQuickCraftRemaining

      private void recalculateQuickCraftRemaining()
    • getHoveredSlot

      private @Nullable Slot getHoveredSlot(double x, double y)
    • mouseClicked

      public boolean mouseClicked(MouseButtonEvent event, boolean doubleClick)
      Specified by:
      mouseClicked in interface ContainerEventHandler
      Specified by:
      mouseClicked in interface GuiEventListener
    • checkHotbarMouseClicked

      private void checkHotbarMouseClicked(MouseButtonEvent event)
    • hasClickedOutside

      protected boolean hasClickedOutside(double mx, double my, int xo, int yo)
    • mouseDragged

      public boolean mouseDragged(MouseButtonEvent event, double dx, double dy)
      Specified by:
      mouseDragged in interface ContainerEventHandler
      Specified by:
      mouseDragged in interface GuiEventListener
    • mouseReleased

      public boolean mouseReleased(MouseButtonEvent event)
      Specified by:
      mouseReleased in interface ContainerEventHandler
      Specified by:
      mouseReleased in interface GuiEventListener
    • clearDraggingState

      public void clearDraggingState()
    • isHovering

      private boolean isHovering(Slot slot, double xm, double ym)
    • isHovering

      protected boolean isHovering(int left, int top, int w, int h, double xm, double ym)
    • onStopHovering

      private void onStopHovering(Slot slot)
    • slotClicked

      protected void slotClicked(Slot slot, int slotId, int buttonNum, ContainerInput containerInput)
    • onMouseClickAction

      void onMouseClickAction(@Nullable Slot slot, ContainerInput containerInput)
    • handleSlotStateChanged

      protected void handleSlotStateChanged(int slotId, int containerId, boolean newState)
    • keyPressed

      public boolean keyPressed(KeyEvent event)
      Specified by:
      keyPressed in interface ContainerEventHandler
      Specified by:
      keyPressed in interface GuiEventListener
      Overrides:
      keyPressed in class Screen
    • checkHotbarKeyPressed

      protected boolean checkHotbarKeyPressed(KeyEvent event)
    • removed

      public void removed()
      Overrides:
      removed in class Screen
    • isPauseScreen

      public boolean isPauseScreen()
      Overrides:
      isPauseScreen in class Screen
    • isInGameUi

      public boolean isInGameUi()
      Overrides:
      isInGameUi in class Screen
    • tick

      public final void tick()
      Overrides:
      tick in class Screen
    • containerTick

      protected void containerTick()
    • shouldAddSlotToQuickCraft

      private boolean shouldAddSlotToQuickCraft(Slot slot, ItemStack carried)
    • quickCraftToSlots

      private void quickCraftToSlots()
    • getMenu

      public T getMenu()
      Specified by:
      getMenu in interface MenuAccess<T extends AbstractContainerMenu>
    • getSlotUnderMouse

      public @Nullable Slot getSlotUnderMouse()
    • getGuiLeft

      public int getGuiLeft()
    • getGuiTop

      public int getGuiTop()
    • getXSize

      public int getXSize()
    • getYSize

      public int getYSize()
    • getSlotColor

      public int getSlotColor(int index)
    • onClose

      public void onClose()
      Overrides:
      onClose in class Screen