Class AbstractConfigPopup<T>

java.lang.Object
johnsmith.configoverhauled.api.client.gui.popup.AbstractConfigPopup<T>
Type Parameters:
T - The value type produced when the popup is applied (may be Void for non-value dialogs).
All Implemented Interfaces:
ConfigPopup, net.minecraft.client.gui.components.events.GuiEventListener, net.minecraft.client.gui.components.TabOrderedElement
Direct Known Subclasses:
ColorPickerPopup, ConfirmPopup, ListDetailPopup, TextDetailPopup

public abstract class AbstractConfigPopup<T> extends Object implements ConfigPopup
Abstract base implementation of ConfigPopup that provides standard modal chrome: dimmed backdrop, responsive centered frame, property title and description header with scope/lock badges, child widget lifecycle and event routing, Tab focus cycling, and standard Reset / Cancel / Apply footer controls.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected @Nullable net.minecraft.client.gui.components.Button
     
    protected static final int
     
    protected static final int
     
    protected @Nullable net.minecraft.client.gui.components.Button
     
    protected int
     
    protected int
     
    protected int
     
    protected int
     
    protected @Nullable net.minecraft.client.gui.components.Button
     
    protected final @Nullable net.minecraft.network.chat.Component
     
    protected static final int
     
    protected static final int
     
    protected final net.minecraft.client.gui.Font
     
    protected int
     
    protected static final int
     
    protected static final int
     
    protected int
     
    protected int
     
    protected int
     
    protected int
     
    protected static final int
     
    protected int
     
    protected final boolean
     
    protected final net.minecraft.client.Minecraft
     
    protected final @Nullable Consumer<T>
     
    protected final ConfigScreen
     
    protected final @Nullable Property<T>
     
    protected @Nullable net.minecraft.client.gui.components.Button
     
    protected int
     
    protected int
     
    protected final net.minecraft.network.chat.Component
     
    protected static final int
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractConfigPopup(ConfigScreen parentScreen, net.minecraft.client.Minecraft minecraft, Property<T> property, boolean isLocked, Consumer<T> onApply)
    Constructs a property-backed modal popup.
    protected
    AbstractConfigPopup(ConfigScreen parentScreen, net.minecraft.client.Minecraft minecraft, net.minecraft.network.chat.Component title, @Nullable net.minecraft.network.chat.Component description, boolean isLocked, @Nullable Consumer<T> onApply)
    Constructs a general-purpose modal popup not bound to a specific Property.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected <L extends net.minecraft.client.gui.components.events.GuiEventListener>
    L
    addListener(L listener)
     
    protected <W extends net.minecraft.client.gui.components.AbstractWidget>
    W
     
    protected void
     
    protected T
     
    protected boolean
     
    boolean
    charTyped(net.minecraft.client.input.CharacterEvent event)
     
    protected void
     
    protected void
     
    protected void
    extractBackdrop(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int screenWidth, int screenHeight)
    Renders the backdrop behind the modal frame.
    protected void
    extractBody(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick)
    Renders custom non-widget content inside the popup body (drawn beneath child widgets).
    protected void
    extractForeground(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick)
    Renders custom foreground overlays after child widgets have been drawn.
    protected void
    extractFrame(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics)
     
    protected void
    extractHeader(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY)
     
    void
    extractRenderState(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick)
    Renders the popup backdrop, frame, and child widgets on top of the parent screen.
    protected net.minecraft.network.chat.Component
     
    protected net.minecraft.network.chat.Component
     
    protected @Nullable net.minecraft.network.chat.Component
     
    protected @Nullable net.minecraft.client.gui.components.events.GuiEventListener
     
    protected int
     
    protected int
     
    protected int
     
    protected int
     
    protected net.minecraft.network.chat.Component
     
    final void
    init(int screenWidth, int screenHeight)
    Initializes or recalculates the popup's layout for the given parent screen dimensions.
    protected abstract void
    initContent(int left, int top, int width, int height)
    Initializes the popup's body widgets inside the provided inner content bounds.
    protected void
    Builds the standard Reset / Cancel / Apply footer buttons.
    protected void
    Optional hook for adding interactive widgets to the popup header bar.
    protected boolean
    isInsideFrame(double x, double y)
     
    protected boolean
     
    boolean
    keyPressed(net.minecraft.client.input.KeyEvent event)
     
    boolean
    keyReleased(net.minecraft.client.input.KeyEvent event)
     
    boolean
    mouseClicked(net.minecraft.client.input.MouseButtonEvent event, boolean doubleClick)
     
    boolean
    mouseDragged(net.minecraft.client.input.MouseButtonEvent event, double dragX, double dragY)
     
    boolean
    mouseReleased(net.minecraft.client.input.MouseButtonEvent event)
     
    boolean
    mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY)
     
    protected void
    removeWidget(net.minecraft.client.gui.components.events.GuiEventListener listener)
     
    protected void
     
    protected void
    setFocusedWidget(@Nullable net.minecraft.client.gui.components.events.GuiEventListener listener)
     
    protected boolean
     
    protected boolean
     
    protected boolean
     
    protected void
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

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

    getBorderForArrowNavigation, getCurrentFocusPath, getRectangle, isMouseOver, mouseMoved, nextFocusPath, preeditUpdated, shouldTakeFocusAfterInteraction

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

    getTabOrderGroup
  • Field Details

    • BACKDROP_COLOR

      protected static final int BACKDROP_COLOR
      See Also:
    • FRAME_BG_COLOR

      protected static final int FRAME_BG_COLOR
      See Also:
    • HEADER_BG_COLOR

      protected static final int HEADER_BG_COLOR
      See Also:
    • BORDER_COLOR

      protected static final int BORDER_COLOR
      See Also:
    • DIVIDER_COLOR

      protected static final int DIVIDER_COLOR
      See Also:
    • TITLE_COLOR

      protected static final int TITLE_COLOR
      See Also:
    • DESCRIPTION_COLOR

      protected static final int DESCRIPTION_COLOR
      See Also:
    • FRAME_PADDING

      protected static final int FRAME_PADDING
      See Also:
    • parentScreen

      protected final ConfigScreen parentScreen
    • minecraft

      protected final net.minecraft.client.Minecraft minecraft
    • font

      protected final net.minecraft.client.gui.Font font
    • property

      @Nullable protected final @Nullable Property<T> property
    • title

      protected final net.minecraft.network.chat.Component title
    • description

      @Nullable protected final @Nullable net.minecraft.network.chat.Component description
    • isLocked

      protected final boolean isLocked
    • onApply

      @Nullable protected final @Nullable Consumer<T> onApply
    • screenWidth

      protected int screenWidth
    • screenHeight

      protected int screenHeight
    • frameLeft

      protected int frameLeft
    • frameTop

      protected int frameTop
    • frameWidth

      protected int frameWidth
    • frameHeight

      protected int frameHeight
    • headerHeight

      protected int headerHeight
    • footerHeight

      protected int footerHeight
    • contentLeft

      protected int contentLeft
    • contentTop

      protected int contentTop
    • contentWidth

      protected int contentWidth
    • contentHeight

      protected int contentHeight
    • copyIdButton

      @Nullable protected @Nullable net.minecraft.client.gui.components.Button copyIdButton
    • resetButton

      @Nullable protected @Nullable net.minecraft.client.gui.components.Button resetButton
    • cancelButton

      @Nullable protected @Nullable net.minecraft.client.gui.components.Button cancelButton
    • applyButton

      @Nullable protected @Nullable net.minecraft.client.gui.components.Button applyButton
  • Constructor Details

    • AbstractConfigPopup

      protected AbstractConfigPopup(ConfigScreen parentScreen, net.minecraft.client.Minecraft minecraft, Property<T> property, boolean isLocked, Consumer<T> onApply)
      Constructs a property-backed modal popup.
    • AbstractConfigPopup

      protected AbstractConfigPopup(ConfigScreen parentScreen, net.minecraft.client.Minecraft minecraft, net.minecraft.network.chat.Component title, @Nullable @Nullable net.minecraft.network.chat.Component description, boolean isLocked, @Nullable @Nullable Consumer<T> onApply)
      Constructs a general-purpose modal popup not bound to a specific Property.
  • Method Details

    • getPreferredWidth

      protected int getPreferredWidth()
    • getPreferredHeight

      protected int getPreferredHeight()
    • getMaxDescriptionLines

      protected int getMaxDescriptionLines()
    • showResetButton

      protected boolean showResetButton()
    • showFooter

      protected boolean showFooter()
    • showCopyIdButton

      protected boolean showCopyIdButton()
    • getHeaderRightPadding

      protected int getHeaderRightPadding()
    • getApplyButtonLabel

      protected net.minecraft.network.chat.Component getApplyButtonLabel()
    • getCancelButtonLabel

      protected net.minecraft.network.chat.Component getCancelButtonLabel()
    • getResetButtonLabel

      protected net.minecraft.network.chat.Component getResetButtonLabel()
    • getDefaultValueTooltip

      @Nullable protected @Nullable net.minecraft.network.chat.Component getDefaultValueTooltip()
    • init

      public final void init(int screenWidth, int screenHeight)
      Description copied from interface: ConfigPopup
      Initializes or recalculates the popup's layout for the given parent screen dimensions. Invoked when the popup is first opened and whenever the window is resized.
      Specified by:
      init in interface ConfigPopup
      Parameters:
      screenWidth - The current width of the parent screen.
      screenHeight - The current height of the parent screen.
    • initHeaderWidgets

      protected void initHeaderWidgets()
      Optional hook for adding interactive widgets to the popup header bar.
    • initContent

      protected abstract void initContent(int left, int top, int width, int height)
      Initializes the popup's body widgets inside the provided inner content bounds.
    • extractBody

      protected void extractBody(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick)
      Renders custom non-widget content inside the popup body (drawn beneath child widgets).
    • extractForeground

      protected void extractForeground(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick)
      Renders custom foreground overlays after child widgets have been drawn.
    • initFooter

      protected void initFooter()
      Builds the standard Reset / Cancel / Apply footer buttons.
    • isWorkingValueValid

      protected boolean isWorkingValueValid()
    • canResetWorkingValue

      protected boolean canResetWorkingValue()
    • resetWorkingValue

      protected void resetWorkingValue()
    • buildResultValue

      @Nullable protected T buildResultValue()
    • updateFooterButtons

      protected void updateFooterButtons()
    • applyAndClose

      protected void applyAndClose()
    • dismiss

      protected void dismiss()
    • addRenderableWidget

      protected <W extends net.minecraft.client.gui.components.AbstractWidget> W addRenderableWidget(W widget)
    • addListener

      protected <L extends net.minecraft.client.gui.components.events.GuiEventListener> L addListener(L listener)
    • removeWidget

      protected void removeWidget(net.minecraft.client.gui.components.events.GuiEventListener listener)
    • clearWidgets

      protected void clearWidgets()
    • setFocusedWidget

      protected void setFocusedWidget(@Nullable @Nullable net.minecraft.client.gui.components.events.GuiEventListener listener)
    • getFocusedWidget

      @Nullable protected @Nullable net.minecraft.client.gui.components.events.GuiEventListener getFocusedWidget()
    • isInsideFrame

      protected boolean isInsideFrame(double x, double y)
    • extractBackdrop

      protected void extractBackdrop(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int screenWidth, int screenHeight)
      Renders the backdrop behind the modal frame. Defaults to a dark scrim to avoid invoking Minecraft's single-pass blur shader twice in the same frame.
    • extractFrame

      protected void extractFrame(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics)
    • extractHeader

      protected void extractHeader(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY)
    • extractRenderState

      public void extractRenderState(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick)
      Description copied from interface: ConfigPopup
      Renders the popup backdrop, frame, and child widgets on top of the parent screen.
      Specified by:
      extractRenderState in interface ConfigPopup
      Parameters:
      guiGraphics - The graphics extractor for the current frame.
      mouseX - The current mouse X coordinate.
      mouseY - The current mouse Y coordinate.
      partialTick - The partial frame tick delta.
    • mouseClicked

      public boolean mouseClicked(net.minecraft.client.input.MouseButtonEvent event, boolean doubleClick)
      Specified by:
      mouseClicked in interface net.minecraft.client.gui.components.events.GuiEventListener
    • mouseReleased

      public boolean mouseReleased(net.minecraft.client.input.MouseButtonEvent event)
      Specified by:
      mouseReleased in interface net.minecraft.client.gui.components.events.GuiEventListener
    • mouseDragged

      public boolean mouseDragged(net.minecraft.client.input.MouseButtonEvent event, double dragX, double dragY)
      Specified by:
      mouseDragged in interface net.minecraft.client.gui.components.events.GuiEventListener
    • mouseScrolled

      public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY)
      Specified by:
      mouseScrolled in interface net.minecraft.client.gui.components.events.GuiEventListener
    • keyPressed

      public boolean keyPressed(net.minecraft.client.input.KeyEvent event)
      Specified by:
      keyPressed in interface net.minecraft.client.gui.components.events.GuiEventListener
    • keyReleased

      public boolean keyReleased(net.minecraft.client.input.KeyEvent event)
      Specified by:
      keyReleased in interface net.minecraft.client.gui.components.events.GuiEventListener
    • charTyped

      public boolean charTyped(net.minecraft.client.input.CharacterEvent event)
      Specified by:
      charTyped in interface net.minecraft.client.gui.components.events.GuiEventListener