Class InventoryScreen
java.lang.Object
net.minecraft.client.gui.components.events.AbstractContainerEventHandler
net.minecraft.client.gui.screens.Screen
net.minecraft.client.gui.screens.inventory.AbstractContainerScreen<InventoryMenu>
net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen<InventoryMenu>
net.minecraft.client.gui.screens.inventory.InventoryScreen
- All Implemented Interfaces:
ContainerEventHandler
,GuiEventListener
,Renderable
,TabOrderedElement
,MenuAccess<InventoryMenu>
,RecipeUpdateListener
public class InventoryScreen
extends EffectRenderingInventoryScreen<InventoryMenu>
implements RecipeUpdateListener
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.client.gui.screens.Screen
Screen.NarratableSearchResult
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private final RecipeBookComponent
private boolean
private float
The old x position of the mouse pointerprivate float
The old y position of the mouse pointerFields 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, slotColor, 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, renderables, screenExecutor, title, width
Fields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
charTyped
(char codePoint, int modifiers) Called when a character is typed within the GUI element.void
protected boolean
hasClickedOutside
(double mouseX, double mouseY, int guiLeft, int guiTop, int mouseButton) protected void
init()
protected boolean
isHovering
(int x, int y, int width, int height, double mouseX, double mouseY) boolean
keyPressed
(int keyCode, int scanCode, int modifiers) Called when a keyboard key is pressed within the GUI element.boolean
mouseClicked
(double mouseX, double mouseY, int button) Called when a mouse button is clicked within the GUI element.boolean
mouseReleased
(double mouseX, double mouseY, int button) Called when a mouse button is released within the GUI element.void
void
render
(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) Renders the graphical user interface (GUI) element.protected void
renderBg
(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) static void
renderEntityInInventory
(GuiGraphics guiGraphics, float x, float y, float scale, org.joml.Vector3f translate, org.joml.Quaternionf pose, org.joml.Quaternionf cameraOrientation, LivingEntity entity) static void
renderEntityInInventoryFollowsAngle
(GuiGraphics p_282802_, int p_275688_, int p_275245_, int p_275535_, int p_294406_, int p_294663_, float p_275604_, float angleXComponent, float angleYComponent, LivingEntity p_275689_) static void
renderEntityInInventoryFollowsMouse
(GuiGraphics guiGraphics, int x1, int y1, int x2, int y2, int scale, float yOffset, float mouseX, float mouseY, LivingEntity entity) protected void
renderLabels
(GuiGraphics guiGraphics, int mouseX, int mouseY) protected void
slotClicked
(Slot slot, int slotId, int mouseButton, ClickType type) Called when the mouse is clicked over a slot or outside the gui.Methods inherited from class net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen
canSeeEffects
Methods inherited from class net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
checkHotbarKeyPressed, clearDraggingState, getGuiLeft, getGuiTop, getMenu, getSlotColor, getSlotUnderMouse, getTooltipFromContainerItem, getXSize, getYSize, handleSlotStateChanged, isPauseScreen, mouseDragged, onClose, removed, renderBackground, renderSlot, renderSlotContents, renderSlotHighlight, renderSlotHighlight, renderSlotHighlight, renderTooltip, 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, getMinecraft, 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
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
-
xMouse
private float xMouseThe old x position of the mouse pointer -
yMouse
private float yMouseThe old y position of the mouse pointer -
recipeBookComponent
-
widthTooNarrow
private boolean widthTooNarrow -
buttonClicked
private boolean buttonClicked
-
-
Constructor Details
-
InventoryScreen
-
-
Method Details
-
containerTick
public void containerTick()- Overrides:
containerTick
in classAbstractContainerScreen<InventoryMenu>
-
init
protected void init()- Overrides:
init
in classAbstractContainerScreen<InventoryMenu>
-
renderLabels
- Overrides:
renderLabels
in classAbstractContainerScreen<InventoryMenu>
-
render
Renders the graphical user interface (GUI) element.- Specified by:
render
in interfaceRenderable
- Overrides:
render
in classEffectRenderingInventoryScreen<InventoryMenu>
- Parameters:
guiGraphics
- the GuiGraphics object used for rendering.mouseX
- the x-coordinate of the mouse cursor.mouseY
- the y-coordinate of the mouse cursor.partialTick
- the partial tick time.
-
renderBg
- Specified by:
renderBg
in classAbstractContainerScreen<InventoryMenu>
-
renderEntityInInventoryFollowsMouse
public static void renderEntityInInventoryFollowsMouse(GuiGraphics guiGraphics, int x1, int y1, int x2, int y2, int scale, float yOffset, float mouseX, float mouseY, LivingEntity entity) -
renderEntityInInventoryFollowsAngle
public static void renderEntityInInventoryFollowsAngle(GuiGraphics p_282802_, int p_275688_, int p_275245_, int p_275535_, int p_294406_, int p_294663_, float p_275604_, float angleXComponent, float angleYComponent, LivingEntity p_275689_) -
renderEntityInInventory
public static void renderEntityInInventory(GuiGraphics guiGraphics, float x, float y, float scale, org.joml.Vector3f translate, org.joml.Quaternionf pose, @Nullable org.joml.Quaternionf cameraOrientation, LivingEntity entity) -
keyPressed
public boolean keyPressed(int keyCode, int scanCode, int modifiers) Called when a keyboard key is pressed within the GUI element.- Specified by:
keyPressed
in interfaceContainerEventHandler
- Specified by:
keyPressed
in interfaceGuiEventListener
- Overrides:
keyPressed
in classAbstractContainerScreen<InventoryMenu>
- Parameters:
keyCode
- the key code of the pressed key.scanCode
- the scan code of the pressed key.modifiers
- the keyboard modifiers.- Returns:
true
if the event is consumed,false
otherwise.
-
charTyped
public boolean charTyped(char codePoint, int modifiers) Called when a character is typed within the GUI element.- Specified by:
charTyped
in interfaceContainerEventHandler
- Specified by:
charTyped
in interfaceGuiEventListener
- Parameters:
codePoint
- the code point of the typed character.modifiers
- the keyboard modifiers.- Returns:
true
if the event is consumed,false
otherwise.
-
isHovering
protected boolean isHovering(int x, int y, int width, int height, double mouseX, double mouseY) - Overrides:
isHovering
in classAbstractContainerScreen<InventoryMenu>
-
mouseClicked
public boolean mouseClicked(double mouseX, double mouseY, int button) Called when a mouse button is clicked within the GUI element.- Specified by:
mouseClicked
in interfaceContainerEventHandler
- Specified by:
mouseClicked
in interfaceGuiEventListener
- Overrides:
mouseClicked
in classAbstractContainerScreen<InventoryMenu>
- Parameters:
mouseX
- the X coordinate of the mouse.mouseY
- the Y coordinate of the mouse.button
- the button that was clicked.- Returns:
true
if the event is consumed,false
otherwise.
-
mouseReleased
public boolean mouseReleased(double mouseX, double mouseY, int button) Called when a mouse button is released within the GUI element.- Specified by:
mouseReleased
in interfaceContainerEventHandler
- Specified by:
mouseReleased
in interfaceGuiEventListener
- Overrides:
mouseReleased
in classAbstractContainerScreen<InventoryMenu>
- Parameters:
mouseX
- the X coordinate of the mouse.mouseY
- the Y coordinate of the mouse.button
- the button that was released.- Returns:
true
if the event is consumed,false
otherwise.
-
hasClickedOutside
protected boolean hasClickedOutside(double mouseX, double mouseY, int guiLeft, int guiTop, int mouseButton) - Overrides:
hasClickedOutside
in classAbstractContainerScreen<InventoryMenu>
-
slotClicked
Called when the mouse is clicked over a slot or outside the gui.- Overrides:
slotClicked
in classAbstractContainerScreen<InventoryMenu>
-
recipesUpdated
public void recipesUpdated()- Specified by:
recipesUpdated
in interfaceRecipeUpdateListener
-
getRecipeBookComponent
- Specified by:
getRecipeBookComponent
in interfaceRecipeUpdateListener
-