Class AbstractContainerScreen<T extends AbstractContainerMenu>
java.lang.Object
net.minecraft.client.gui.components.events.AbstractContainerEventHandler
net.minecraft.client.gui.screens.Screen
net.minecraft.client.gui.screens.inventory.AbstractContainerScreen<T>
- 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>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final recordNested classes/interfaces inherited from class Screen
Screen.NarratableSearchResult -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intprotected static final intprivate @Nullable SlotUsed when touchscreen is enabledprotected static final intprotected static final intprivate booleanprivate ItemStackUsed when touchscreen is enabledprotected @Nullable SlotHolds the slot currently hoveredprotected final intThe Y size of the inventory window in pixels.protected final intThe X size of the inventory window in pixels.static final IdentifierThe location of the inventory background textureprotected intprotected intprotected booleanprivate booleanUsed when touchscreen is enabled.private final List<ItemSlotMouseAction> private @Nullable Slotprivate ItemStackprotected intStarting X position for the Gui.protected final TA list of the players inventory slotsprotected final Componentprivate intprivate intprivate intprivate static final intprivate @Nullable Slotprivate longprivate booleanprivate static final Identifierprivate static final Identifierprotected intprivate static final floatprivate @Nullable AbstractContainerScreen.SnapbackDataprotected intprotected intprotected intStarting Y position for the Gui.Fields inherited from class Screen
FADE_IN_TIME, font, FOOTER_SEPARATOR, HEADER_SEPARATOR, height, INWORLD_FOOTER_SEPARATOR, INWORLD_HEADER_SEPARATOR, MENU_BACKGROUND, minecraft, narratorButton, renderables, screenExecutor, title, width -
Constructor Summary
ConstructorsConstructorDescriptionAbstractContainerScreen(T menu, Inventory inventory, Component title) AbstractContainerScreen(T menu, Inventory inventory, Component title, int imageWidth, int imageHeight) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddItemSlotMouseAction(ItemSlotMouseAction itemSlotMouseAction) protected booleancheckHotbarKeyPressed(KeyEvent event) private voidvoidprotected voidintintprivate @Nullable SlotgetHoveredSlot(double x, double y) getMenu()intgetSlotColor(int index) @Nullable SlotgetTooltipFromContainerItem(ItemStack itemStack) intgetXSize()intgetYSize()protected voidhandleSlotStateChanged(int slotId, int containerId, boolean newState) protected booleanhasClickedOutside(double mx, double my, int xo, int yo) protected voidinit()protected booleanisHovering(int left, int top, int w, int h, double xm, double ym) private booleanisHovering(Slot slot, double xm, double ym) booleanbooleanbooleankeyPressed(KeyEvent event) booleanmouseClicked(MouseButtonEvent event, boolean doubleClick) booleanmouseDragged(MouseButtonEvent event, double dx, double dy) booleanmouseReleased(MouseButtonEvent event) booleanmouseScrolled(double x, double y, double scrollX, double scrollY) voidonClose()(package private) voidonMouseClickAction(@Nullable Slot slot, ContainerInput containerInput) private voidonStopHovering(Slot slot) private voidprivate voidvoidremoved()voidrender(GuiGraphics graphics, int mouseX, int mouseY, float a) Renders the graphical user interface (GUI) element.voidrenderBackground(GuiGraphics graphics, int mouseX, int mouseY, float a) protected abstract voidrenderBg(GuiGraphics graphics, float a, int xm, int ym) voidrenderCarriedItem(GuiGraphics graphics, int mouseX, int mouseY) voidrenderContents(GuiGraphics graphics, int mouseX, int mouseY, float a) private voidrenderFloatingItem(GuiGraphics graphics, ItemStack carried, int x, int y, @Nullable String itemCount) protected voidrenderLabels(GuiGraphics graphics, int xm, int ym) protected voidrenderSlot(GuiGraphics graphics, Slot slot, int mouseX, int mouseY) protected voidrenderSlotContents(GuiGraphics graphics, ItemStack itemStack, Slot slot, @Nullable String itemCount) private voidrenderSlotHighlightBack(GuiGraphics graphics) private voidrenderSlotHighlightFront(GuiGraphics graphics) protected voidrenderSlots(GuiGraphics graphics, int mouseX, int mouseY) voidrenderSnapbackItem(GuiGraphics graphics) protected voidrenderTooltip(GuiGraphics graphics, int mouseX, int mouseY) private booleanshouldAddSlotToQuickCraft(Slot slot, ItemStack carried) private booleanprotected voidslotClicked(Slot slot, int slotId, int buttonNum, ContainerInput containerInput) final voidtick()Methods inherited from class Screen
added, addRenderableOnly, addRenderableWidget, addWidget, afterKeyboardAction, afterMouseAction, afterMouseMove, canInterruptWithAnotherScreen, changeFocus, children, clearFocus, clearWidgets, clickCommandAction, clickUrlAction, defaultHandleClickEvent, defaultHandleGameClickEvent, fadeWidgets, fillCrashDetails, findNarratableWidget, getBackgroundMusic, getFont, getMinecraft, getNarrationMessage, getRectangle, getTitle, getTooltipFromItem, getUsageNarration, handleDelayedNarration, init, insertText, isAllowedInPortal, isMouseOver, isValidCharacterForName, onFilesDrop, panoramaShouldSpin, rebuildWidgets, removeWidget, renderBlurredBackground, renderMenuBackground, renderMenuBackground, renderMenuBackgroundTexture, renderPanorama, renderTransparentBackground, renderWithTooltipAndSubtitles, repositionElements, resize, setInitialFocus, setInitialFocus, shouldCloseOnEsc, shouldNarrateNavigation, showsActiveEffects, triggerImmediateNarration, updateNarratedWidget, updateNarrationState, updateNarratorStatusMethods inherited from class AbstractContainerEventHandler
getFocused, isDragging, setDragging, setFocusedMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ContainerEventHandler
charTyped, getBorderForArrowNavigation, getChildAt, getCurrentFocusPath, isFocused, keyReleased, nextFocusPath, setFocusedMethods inherited from interface GuiEventListener
mouseMoved, shouldTakeFocusAfterInteractionMethods inherited from interface TabOrderedElement
getTabOrderGroup
-
Field Details
-
INVENTORY_LOCATION
The location of the inventory background texture -
SLOT_HIGHLIGHT_BACK_SPRITE
-
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 imageWidthThe X size of the inventory window in pixels. -
imageHeight
protected final int imageHeightThe Y size of the inventory window in pixels. -
titleLabelX
protected int titleLabelX -
titleLabelY
protected int titleLabelY -
inventoryLabelX
protected int inventoryLabelX -
inventoryLabelY
protected int inventoryLabelY -
itemSlotMouseActions
-
playerInventoryTitle
-
hoveredSlot
Holds the slot currently hovered -
clickedSlot
Used when touchscreen is enabled -
quickdropSlot
-
lastClickSlot
-
snapbackData
-
leftPos
protected int leftPosStarting X position for the Gui. Inconsistent use for Gui backgrounds. -
topPos
protected int topPosStarting Y position for the Gui. Inconsistent use for Gui backgrounds. -
isSplittingStack
private boolean isSplittingStackUsed when touchscreen is enabled. -
draggingItem
Used when touchscreen is enabled -
quickdropTime
private long quickdropTime -
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
-
slotColor
protected int slotColor
-
-
Constructor Details
-
AbstractContainerScreen
-
AbstractContainerScreen
-
-
Method Details
-
init
-
addItemSlotMouseAction
-
render
Description copied from interface:RenderableRenders the graphical user interface (GUI) element.- Specified by:
renderin interfaceRenderable- Overrides:
renderin classScreen- Parameters:
graphics- the GuiGraphics object used for rendering.mouseX- the x-coordinate of the mouse cursor.mouseY- the y-coordinate of the mouse cursor.a- the partial tick time.
-
renderContents
-
renderCarriedItem
-
renderSnapbackItem
-
renderSlots
-
renderBackground
- Overrides:
renderBackgroundin classScreen
-
mouseScrolled
public boolean mouseScrolled(double x, double y, double scrollX, double scrollY) - Specified by:
mouseScrolledin interfaceContainerEventHandler- Specified by:
mouseScrolledin interfaceGuiEventListener
-
renderSlotHighlightBack
-
renderSlotHighlightFront
-
renderTooltip
-
showTooltipWithItemInHand
-
getTooltipFromContainerItem
-
renderFloatingItem
private void renderFloatingItem(GuiGraphics graphics, ItemStack carried, int x, int y, @Nullable String itemCount) -
renderLabels
-
renderBg
-
renderSlot
-
renderSlotContents
protected void renderSlotContents(GuiGraphics graphics, ItemStack itemStack, Slot slot, @Nullable String itemCount) -
recalculateQuickCraftRemaining
private void recalculateQuickCraftRemaining() -
getHoveredSlot
-
mouseClicked
- Specified by:
mouseClickedin interfaceContainerEventHandler- Specified by:
mouseClickedin interfaceGuiEventListener
-
checkHotbarMouseClicked
-
hasClickedOutside
protected boolean hasClickedOutside(double mx, double my, int xo, int yo) -
mouseDragged
- Specified by:
mouseDraggedin interfaceContainerEventHandler- Specified by:
mouseDraggedin interfaceGuiEventListener
-
mouseReleased
- Specified by:
mouseReleasedin interfaceContainerEventHandler- Specified by:
mouseReleasedin interfaceGuiEventListener
-
clearDraggingState
public void clearDraggingState() -
isHovering
-
isHovering
protected boolean isHovering(int left, int top, int w, int h, double xm, double ym) -
onStopHovering
-
slotClicked
-
onMouseClickAction
-
handleSlotStateChanged
protected void handleSlotStateChanged(int slotId, int containerId, boolean newState) -
keyPressed
- Specified by:
keyPressedin interfaceContainerEventHandler- Specified by:
keyPressedin interfaceGuiEventListener- Overrides:
keyPressedin classScreen
-
checkHotbarKeyPressed
-
removed
-
isPauseScreen
public boolean isPauseScreen()- Overrides:
isPauseScreenin classScreen
-
isInGameUi
public boolean isInGameUi()- Overrides:
isInGameUiin classScreen
-
tick
-
containerTick
protected void containerTick() -
shouldAddSlotToQuickCraft
-
quickCraftToSlots
private void quickCraftToSlots() -
getMenu
- Specified by:
getMenuin interfaceMenuAccess<T extends AbstractContainerMenu>
-
getSlotUnderMouse
-
getGuiLeft
public int getGuiLeft() -
getGuiTop
public int getGuiTop() -
getXSize
public int getXSize() -
getYSize
public int getYSize() -
getSlotColor
public int getSlotColor(int index) -
onClose
-