Class EnchantmentScreen
java.lang.Object
net.minecraft.client.gui.components.events.AbstractContainerEventHandler
net.minecraft.client.gui.screens.Screen
net.minecraft.client.gui.screens.inventory.AbstractContainerScreen<EnchantmentMenu>
johnsmith.enchantingoverhauled.client.gui.screen.enchant.EnchantmentScreen
- 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<EnchantmentMenu>
public class EnchantmentScreen
extends net.minecraft.client.gui.screens.inventory.AbstractContainerScreen<EnchantmentMenu>
The main Graphical User Interface (GUI) screen for the custom Enchanting Altar.
This screen coordinates the rendering and interaction of various widgets including
the scrollable enchantment list, the reroll button, page navigation, and the experience bar.
It observes the underlying EnchantmentMenu for state changes.
-
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 inherited from class net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
BACKGROUND_TEXTURE_HEIGHT, BACKGROUND_TEXTURE_WIDTH, hoveredSlot, imageHeight, imageWidth, INVENTORY_LOCATION, inventoryLabelX, inventoryLabelY, isQuickCrafting, leftPos, menu, playerInventoryTitle, quickCraftSlots, titleLabelX, titleLabelY, topPosFields 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, screenExecutor, title, width -
Constructor Summary
ConstructorsConstructorDescriptionEnchantmentScreen(EnchantmentMenu menu, net.minecraft.world.entity.player.Inventory playerInventory, net.minecraft.network.chat.Component title) Constructs a new Enchantment Screen. -
Method Summary
Modifier and TypeMethodDescriptionvoidTicks the screen, tracking changes to the enchantment seed or available contexts to trigger a visual refresh.protected voidinit()Initializes the UI components, calculates bounds, and configures the child widgets (Reroll, Navigation) when the screen is first opened or resized.booleanmouseClicked(net.minecraft.client.input.MouseButtonEvent event, boolean isDoubleClick) Delegates mouse click events to child components (reroll widget, enchantment slots, pagination).booleanmouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) Handles mouse wheel scrolling, delegating to the pagination widget to scroll the view.voidSynchronizes the visibleEnchantWidgetobjects with the underlying data model.voidrender(@NotNull net.minecraft.client.gui.GuiGraphics context, int mouseX, int mouseY, float partialTick) Top-level render call.protected voidrenderBg(net.minecraft.client.gui.GuiGraphics context, float partialTick, int mouseX, int mouseY) Renders the background texture, empty slot ghosts, widgets, and the experience bar.protected voidrenderLabels(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY) Renders the labels for the screen, adjusting inventory title placement due to height adjustments.Methods inherited from class net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
addItemSlotMouseAction, checkHotbarKeyPressed, clearDraggingState, getMenu, getTooltipFromContainerItem, handleSlotStateChanged, hasClickedOutside, isHovering, isInGameUi, isPauseScreen, keyPressed, mouseDragged, mouseReleased, onClose, removed, renderBackground, renderCarriedItem, renderContents, renderSlot, renderSlots, renderSnapbackItem, renderTooltip, slotClicked, tickMethods 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, 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 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
-
Constructor Details
-
Method Details
-
init
protected void init()Initializes the UI components, calculates bounds, and configures the child widgets (Reroll, Navigation) when the screen is first opened or resized.- Overrides:
initin classnet.minecraft.client.gui.screens.inventory.AbstractContainerScreen<EnchantmentMenu>
-
containerTick
public void containerTick()Ticks the screen, tracking changes to the enchantment seed or available contexts to trigger a visual refresh. Discards pagination offset if the target item is removed.- Overrides:
containerTickin classnet.minecraft.client.gui.screens.inventory.AbstractContainerScreen<EnchantmentMenu>
-
refreshWidgets
public void refreshWidgets()Synchronizes the visibleEnchantWidgetobjects with the underlying data model. Evaluates which contexts are currently visible given the scroll offset, creating or mutating the stateful widget components to match. -
renderBg
protected void renderBg(net.minecraft.client.gui.GuiGraphics context, float partialTick, int mouseX, int mouseY) Renders the background texture, empty slot ghosts, widgets, and the experience bar.- Specified by:
renderBgin classnet.minecraft.client.gui.screens.inventory.AbstractContainerScreen<EnchantmentMenu>- Parameters:
context- The GUI graphics context.partialTick- The partial tick time for animations.mouseX- The current mouse X coordinate.mouseY- The current mouse Y coordinate.
-
renderLabels
protected void renderLabels(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY) Renders the labels for the screen, adjusting inventory title placement due to height adjustments.- Overrides:
renderLabelsin classnet.minecraft.client.gui.screens.inventory.AbstractContainerScreen<EnchantmentMenu>- Parameters:
graphics- The GUI graphics context.mouseX- The current mouse X coordinate.mouseY- The current mouse Y coordinate.
-
render
public void render(@NotNull @NotNull net.minecraft.client.gui.GuiGraphics context, int mouseX, int mouseY, float partialTick) Top-level render call. Ensures the background is drawn, delegates to super for children, and evaluates tooltips based on the hovered widget.- Specified by:
renderin interfacenet.minecraft.client.gui.components.Renderable- Overrides:
renderin classnet.minecraft.client.gui.screens.inventory.AbstractContainerScreen<EnchantmentMenu>- Parameters:
context- The GUI graphics context.mouseX- The current mouse X coordinate.mouseY- The current mouse Y coordinate.partialTick- The partial tick time for animations.
-
mouseClicked
public boolean mouseClicked(net.minecraft.client.input.MouseButtonEvent event, boolean isDoubleClick) Delegates mouse click events to child components (reroll widget, enchantment slots, pagination).- Specified by:
mouseClickedin interfacenet.minecraft.client.gui.components.events.ContainerEventHandler- Specified by:
mouseClickedin interfacenet.minecraft.client.gui.components.events.GuiEventListener- Overrides:
mouseClickedin classnet.minecraft.client.gui.screens.inventory.AbstractContainerScreen<EnchantmentMenu>- Parameters:
event- The mouse button event.isDoubleClick- The mouse button being clicked.- Returns:
- true if the event was consumed, false otherwise.
-
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) Handles mouse wheel scrolling, delegating to the pagination widget to scroll the view.- Specified by:
mouseScrolledin interfacenet.minecraft.client.gui.components.events.ContainerEventHandler- Specified by:
mouseScrolledin interfacenet.minecraft.client.gui.components.events.GuiEventListener- Overrides:
mouseScrolledin classnet.minecraft.client.gui.screens.inventory.AbstractContainerScreen<EnchantmentMenu>- Parameters:
mouseX- The X coordinate of the mouse.mouseY- The Y coordinate of the mouse.horizontalAmount- The horizontal scroll delta.verticalAmount- The vertical scroll delta.- Returns:
- true if the scroll event was consumed, false otherwise.
-