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 beVoidfor 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
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
FieldsModifier and TypeFieldDescriptionprotected @Nullable net.minecraft.client.gui.components.Buttonprotected static final intprotected static final intprotected @Nullable net.minecraft.client.gui.components.Buttonprotected intprotected intprotected intprotected intprotected @Nullable net.minecraft.client.gui.components.Buttonprotected final @Nullable net.minecraft.network.chat.Componentprotected static final intprotected static final intprotected final net.minecraft.client.gui.Fontprotected intprotected static final intprotected static final intprotected intprotected intprotected intprotected intprotected static final intprotected intprotected final booleanprotected final net.minecraft.client.Minecraftprotected final ConfigScreenprotected @Nullable net.minecraft.client.gui.components.Buttonprotected intprotected intprotected final net.minecraft.network.chat.Componentprotected static final int -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractConfigPopup(ConfigScreen parentScreen, net.minecraft.client.Minecraft minecraft, Property<T> property, boolean isLocked, Consumer<T> onApply) Constructs a property-backed modal popup.protectedAbstractConfigPopup(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 specificProperty. -
Method Summary
Modifier and TypeMethodDescriptionprotected <L extends net.minecraft.client.gui.components.events.GuiEventListener>
LaddListener(L listener) protected <W extends net.minecraft.client.gui.components.AbstractWidget>
WaddRenderableWidget(W widget) protected voidprotected Tprotected booleanbooleancharTyped(net.minecraft.client.input.CharacterEvent event) protected voidprotected voiddismiss()protected voidextractBackdrop(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int screenWidth, int screenHeight) Renders the backdrop behind the modal frame.protected voidextractBody(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 voidextractForeground(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick) Renders custom foreground overlays after child widgets have been drawn.protected voidextractFrame(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics) protected voidextractHeader(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY) voidextractRenderState(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.Componentprotected net.minecraft.network.chat.Componentprotected @Nullable net.minecraft.network.chat.Componentprotected @Nullable net.minecraft.client.gui.components.events.GuiEventListenerprotected intprotected intprotected intprotected intprotected net.minecraft.network.chat.Componentfinal voidinit(int screenWidth, int screenHeight) Initializes or recalculates the popup's layout for the given parent screen dimensions.protected abstract voidinitContent(int left, int top, int width, int height) Initializes the popup's body widgets inside the provided inner content bounds.protected voidBuilds the standard Reset / Cancel / Apply footer buttons.protected voidOptional hook for adding interactive widgets to the popup header bar.protected booleanisInsideFrame(double x, double y) protected booleanbooleankeyPressed(net.minecraft.client.input.KeyEvent event) booleankeyReleased(net.minecraft.client.input.KeyEvent event) booleanmouseClicked(net.minecraft.client.input.MouseButtonEvent event, boolean doubleClick) booleanmouseDragged(net.minecraft.client.input.MouseButtonEvent event, double dragX, double dragY) booleanmouseReleased(net.minecraft.client.input.MouseButtonEvent event) booleanmouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) protected voidremoveWidget(net.minecraft.client.gui.components.events.GuiEventListener listener) protected voidprotected voidsetFocusedWidget(@Nullable net.minecraft.client.gui.components.events.GuiEventListener listener) protected booleanprotected booleanprotected booleanprotected voidMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ConfigPopup
closeOnEscape, closeOnOutsideClick, isFocused, onClose, setFocused, tickMethods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
getBorderForArrowNavigation, getCurrentFocusPath, getRectangle, isMouseOver, mouseMoved, nextFocusPath, preeditUpdated, shouldTakeFocusAfterInteractionMethods 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
-
minecraft
protected final net.minecraft.client.Minecraft minecraft -
font
protected final net.minecraft.client.gui.Font font -
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
-
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 -
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 specificProperty.
-
-
Method Details
-
getPreferredWidth
protected int getPreferredWidth() -
getPreferredHeight
protected int getPreferredHeight() -
getMaxDescriptionLines
protected int getMaxDescriptionLines() -
showResetButton
protected boolean showResetButton() -
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:ConfigPopupInitializes 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:
initin interfaceConfigPopup- 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. -
isWorkingValueValid
protected boolean isWorkingValueValid() -
canResetWorkingValue
protected boolean canResetWorkingValue() -
resetWorkingValue
protected void resetWorkingValue() -
buildResultValue
-
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:ConfigPopupRenders the popup backdrop, frame, and child widgets on top of the parent screen.- Specified by:
extractRenderStatein interfaceConfigPopup- 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:
mouseClickedin interfacenet.minecraft.client.gui.components.events.GuiEventListener
-
mouseReleased
public boolean mouseReleased(net.minecraft.client.input.MouseButtonEvent event) - Specified by:
mouseReleasedin interfacenet.minecraft.client.gui.components.events.GuiEventListener
-
mouseDragged
public boolean mouseDragged(net.minecraft.client.input.MouseButtonEvent event, double dragX, double dragY) - Specified by:
mouseDraggedin interfacenet.minecraft.client.gui.components.events.GuiEventListener
-
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) - Specified by:
mouseScrolledin interfacenet.minecraft.client.gui.components.events.GuiEventListener
-
keyPressed
public boolean keyPressed(net.minecraft.client.input.KeyEvent event) - Specified by:
keyPressedin interfacenet.minecraft.client.gui.components.events.GuiEventListener
-
keyReleased
public boolean keyReleased(net.minecraft.client.input.KeyEvent event) - Specified by:
keyReleasedin interfacenet.minecraft.client.gui.components.events.GuiEventListener
-
charTyped
public boolean charTyped(net.minecraft.client.input.CharacterEvent event) - Specified by:
charTypedin interfacenet.minecraft.client.gui.components.events.GuiEventListener
-