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, topPos

    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, screenExecutor, title, width
  • Constructor Summary

    Constructors
    Constructor
    Description
    EnchantmentScreen(EnchantmentMenu menu, net.minecraft.world.entity.player.Inventory playerInventory, net.minecraft.network.chat.Component title)
    Constructs a new Enchantment Screen.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Ticks the screen, tracking changes to the enchantment seed or available contexts to trigger a visual refresh.
    protected void
    Initializes the UI components, calculates bounds, and configures the child widgets (Reroll, Navigation) when the screen is first opened or resized.
    boolean
    mouseClicked(net.minecraft.client.input.MouseButtonEvent event, boolean isDoubleClick)
    Delegates mouse click events to child components (reroll widget, enchantment slots, pagination).
    boolean
    mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount)
    Handles mouse wheel scrolling, delegating to the pagination widget to scroll the view.
    void
    Synchronizes the visible EnchantWidget objects with the underlying data model.
    void
    render(@NotNull net.minecraft.client.gui.GuiGraphics context, int mouseX, int mouseY, float partialTick)
    Top-level render call.
    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.
    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.

    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, tick

    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, 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, updateNarratorStatus

    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

    charTyped, getChildAt, getCurrentFocusPath, isFocused, keyReleased, nextFocusPath, setFocused

    Methods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener

    getBorderForArrowNavigation, mouseMoved, shouldTakeFocusAfterInteraction

    Methods inherited from interface net.minecraft.client.gui.components.TabOrderedElement

    getTabOrderGroup
  • Constructor Details

    • EnchantmentScreen

      public EnchantmentScreen(EnchantmentMenu menu, net.minecraft.world.entity.player.Inventory playerInventory, net.minecraft.network.chat.Component title)
      Constructs a new Enchantment Screen.
      Parameters:
      menu - The server-side menu container bridging the inventory.
      playerInventory - The player's current inventory.
      title - The title component of the screen (typically modified to use the galactic font).
  • 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:
      init in class net.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:
      containerTick in class net.minecraft.client.gui.screens.inventory.AbstractContainerScreen<EnchantmentMenu>
    • refreshWidgets

      public void refreshWidgets()
      Synchronizes the visible EnchantWidget objects 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:
      renderBg in class net.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:
      renderLabels in class net.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:
      render in interface net.minecraft.client.gui.components.Renderable
      Overrides:
      render in class net.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:
      mouseClicked in interface net.minecraft.client.gui.components.events.ContainerEventHandler
      Specified by:
      mouseClicked in interface net.minecraft.client.gui.components.events.GuiEventListener
      Overrides:
      mouseClicked in class net.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:
      mouseScrolled in interface net.minecraft.client.gui.components.events.ContainerEventHandler
      Specified by:
      mouseScrolled in interface net.minecraft.client.gui.components.events.GuiEventListener
      Overrides:
      mouseScrolled in class net.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.