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:
AbstractRecipeBookScreen,BeaconScreen,BrewingStandScreen,CartographyTableScreen,ContainerScreen,CrafterScreen,CreativeModeInventoryScreen,DispenserScreen,EnchantmentScreen,GrindstoneScreen,HopperScreen,HorseInventoryScreen,ItemCombinerScreen,LoomScreen,MerchantScreen,ShulkerBoxScreen,StonecutterScreen
public abstract class AbstractContainerScreen<T extends AbstractContainerMenu>
extends Screen
implements MenuAccess<T>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final recordNested classes/interfaces inherited from class net.minecraft.client.gui.screens.Screen
Screen.NarratableSearchResult -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intprotected static final intprivate SlotUsed when touchscreen is enabledprivate booleanprivate ItemStackUsed when touchscreen is enabledprotected SlotHolds the slot currently hoveredprotected intThe Y size of the inventory window in pixels.protected intThe X size of the inventory window in pixels.static final ResourceLocationThe location of the inventory background textureprotected intprotected intprotected booleanprivate booleanUsed when touchscreen is enabled.private final List<ItemSlotMouseAction> private 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 Slotprivate longprivate booleanprivate static final ResourceLocationprivate static final ResourceLocationprotected intprivate static final floatprotected intprotected intprotected intStarting Y position for the Gui.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, renderables, screenExecutor, title, width -
Constructor Summary
ConstructorsConstructorDescriptionAbstractContainerScreen(T pMenu, Inventory pPlayerInventory, Component pTitle) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddItemSlotMouseAction(ItemSlotMouseAction pItemSlotMouseAction) protected booleancheckHotbarKeyPressed(KeyEvent pEvent) private voidvoidprotected voidintintprivate SlotgetHoveredSlot(double pMouseX, double pMouseY) getMenu()intgetSlotColor(int index) @Nullable SlotgetTooltipFromContainerItem(ItemStack pStack) intgetXSize()intgetYSize()protected voidhandleSlotStateChanged(int pSlotId, int pContainerId, boolean pNewState) protected booleanhasClickedOutside(double pX, double pY, int pLeft, int pTop) protected voidinit()protected booleanisHovering(int pX, int pY, int pWidth, int pHeight, double pMouseX, double pMouseY) private booleanisHovering(Slot pSlot, double pMouseX, double pMouseY) booleanbooleanbooleankeyPressed(KeyEvent p_445387_) booleanmouseClicked(MouseButtonEvent p_446548_, boolean p_432883_) booleanmouseDragged(MouseButtonEvent p_446671_, double p_97752_, double p_97753_) booleanmouseReleased(MouseButtonEvent p_446114_) booleanmouseScrolled(double p_364830_, double p_360707_, double p_364436_, double p_364417_) voidonClose()(package private) voidonMouseClickAction(Slot pSlot, ClickType pType) private voidonStopHovering(Slot pSlot) private voidvoidremoved()voidrender(GuiGraphics p_283479_, int p_283661_, int p_281248_, float p_281886_) Renders the graphical user interface (GUI) element.voidrenderBackground(GuiGraphics p_295206_, int p_295457_, int p_294596_, float p_296351_) protected abstract voidrenderBg(GuiGraphics pGuiGraphics, float pPartialTick, int pMouseX, int pMouseY) voidrenderCarriedItem(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY) voidrenderContents(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) private voidrenderFloatingItem(GuiGraphics pGuiGraphics, ItemStack pStack, int pX, int pY, String pText) protected voidrenderLabels(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY) protected voidrenderSlot(GuiGraphics pGuiGraphics, Slot pSlot) protected voidrenderSlotContents(GuiGraphics guiGraphics, ItemStack itemstack, Slot slot, String countString) private voidrenderSlotHighlightBack(GuiGraphics pGuiGraphics) private voidrenderSlotHighlightFront(GuiGraphics pGuiGraphics) protected voidrenderSlots(GuiGraphics pGuiGraphics) voidrenderSnapbackItem(GuiGraphics pGuiGraphics) protected voidrenderTooltip(GuiGraphics pGuiGraphics, int pX, int pY) private booleanshowTooltipWithItemInHand(ItemStack pStack) protected voidslotClicked(Slot pSlot, int pSlotId, int pMouseButton, ClickType pType) Called when the mouse is clicked over a slot or outside the gui.final voidtick()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, fadeWidgets, fillCrashDetails, findNarratableWidget, getBackgroundMusic, getFont, getMinecraft, getNarrationMessage, getRectangle, getTitle, getTooltipFromItem, getUsageNarration, handleClickEvent, handleComponentClicked, 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 net.minecraft.client.gui.components.events.AbstractContainerEventHandler
getFocused, isDragging, setDragging, setFocusedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.components.events.ContainerEventHandler
charTyped, getChildAt, getCurrentFocusPath, isFocused, keyReleased, nextFocusPath, setFocusedMethods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
getBorderForArrowNavigation, mouseMoved, shouldTakeFocusAfterInteractionMethods inherited from interface net.minecraft.client.gui.components.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:
-
imageWidth
protected int imageWidthThe X size of the inventory window in pixels. -
imageHeight
protected 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
-
-
Method Details
-
init
protected void init() -
addItemSlotMouseAction
-
render
Description copied from interface:RenderableRenders the graphical user interface (GUI) element.- Specified by:
renderin interfaceRenderable- Overrides:
renderin classScreen- Parameters:
p_283479_- the GuiGraphics object used for rendering.p_283661_- the x-coordinate of the mouse cursor.p_281248_- the y-coordinate of the mouse cursor.p_281886_- the partial tick time.
-
renderContents
-
renderCarriedItem
-
renderSnapbackItem
-
renderSlots
-
renderBackground
- Overrides:
renderBackgroundin classScreen
-
mouseScrolled
public boolean mouseScrolled(double p_364830_, double p_360707_, double p_364436_, double p_364417_) - Specified by:
mouseScrolledin interfaceContainerEventHandler- Specified by:
mouseScrolledin interfaceGuiEventListener
-
renderSlotHighlightBack
-
renderSlotHighlightFront
-
renderTooltip
-
showTooltipWithItemInHand
-
getTooltipFromContainerItem
-
renderFloatingItem
private void renderFloatingItem(GuiGraphics pGuiGraphics, ItemStack pStack, int pX, int pY, @Nullable String pText) -
renderLabels
-
renderBg
protected abstract void renderBg(GuiGraphics pGuiGraphics, float pPartialTick, int pMouseX, int pMouseY) -
renderSlot
-
renderSlotContents
protected void renderSlotContents(GuiGraphics guiGraphics, ItemStack itemstack, Slot slot, @Nullable String countString) -
recalculateQuickCraftRemaining
private void recalculateQuickCraftRemaining() -
getHoveredSlot
-
mouseClicked
- Specified by:
mouseClickedin interfaceContainerEventHandler- Specified by:
mouseClickedin interfaceGuiEventListener
-
checkHotbarMouseClicked
-
hasClickedOutside
protected boolean hasClickedOutside(double pX, double pY, int pLeft, int pTop) -
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 pX, int pY, int pWidth, int pHeight, double pMouseX, double pMouseY) -
onStopHovering
-
slotClicked
Called when the mouse is clicked over a slot or outside the gui. -
onMouseClickAction
-
handleSlotStateChanged
protected void handleSlotStateChanged(int pSlotId, int pContainerId, boolean pNewState) -
keyPressed
- Specified by:
keyPressedin interfaceContainerEventHandler- Specified by:
keyPressedin interfaceGuiEventListener- Overrides:
keyPressedin classScreen
-
checkHotbarKeyPressed
-
removed
public void removed() -
isPauseScreen
public boolean isPauseScreen()- Overrides:
isPauseScreenin classScreen
-
isInGameUi
public boolean isInGameUi()- Overrides:
isInGameUiin classScreen
-
tick
public final void tick() -
containerTick
protected void containerTick() -
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
public void onClose()
-