Class TextDetailPopup<T>
java.lang.Object
johnsmith.configoverhauled.api.client.gui.popup.AbstractConfigPopup<T>
johnsmith.configoverhauled.impl.client.gui.popup.TextDetailPopup<T>
- Type Parameters:
T- The property value type.
- All Implemented Interfaces:
ConfigPopup, net.minecraft.client.gui.components.events.GuiEventListener, net.minecraft.client.gui.components.TabOrderedElement
- Direct Known Subclasses:
NumericDetailPopup, StringDetailPopup
Reusable modal popup base for editing single text-backed configuration properties in a spacious
centered
EditBox with live validation, inline error feedback, and default/metadata hints.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected net.minecraft.client.gui.components.Buttonprotected net.minecraft.client.gui.components.EditBoxprotected static final intprotected static final intprotected Stringprotected Tprotected static final intprotected @Nullable net.minecraft.network.chat.Componentprotected StringFields inherited from class AbstractConfigPopup
applyButton, BACKDROP_COLOR, BORDER_COLOR, cancelButton, contentHeight, contentLeft, contentTop, contentWidth, copyIdButton, description, DESCRIPTION_COLOR, DIVIDER_COLOR, font, footerHeight, FRAME_BG_COLOR, FRAME_PADDING, frameHeight, frameLeft, frameTop, frameWidth, HEADER_BG_COLOR, headerHeight, isLocked, minecraft, onApply, parentScreen, property, resetButton, screenHeight, screenWidth, title, TITLE_COLOR -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTextDetailPopup(ConfigScreen parentScreen, net.minecraft.client.Minecraft minecraft, Property<T> property, @Nullable String initialText, boolean isLocked, Consumer<T> onApply) -
Method Summary
Modifier and TypeMethodDescriptionprotected Tprotected booleanprotected 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 abstract StringformatValue(T value) protected net.minecraft.network.chat.Componentprotected @Nullable net.minecraft.network.chat.Componentprotected intprotected intprotected intprotected @Nullable Stringprotected @Nullable net.minecraft.network.chat.Componentprotected voidinitContent(int left, int top, int width, int height) Initializes the popup's body widgets inside the provided inner content bounds.protected voidinitExtraContent(int left, int top, int width, int height) protected booleanprotected voidonWorkingValueChanged(T newValue, boolean valid) protected voidprotected voidrevalidate(boolean notifySubclass) protected voidsetWorkingText(String newText) protected StringtrimToWidth(String text, int maxWidth) protected abstract TextDetailPopup.ValidationResult<T> validateInput(String text) Methods inherited from class AbstractConfigPopup
addListener, addRenderableWidget, applyAndClose, charTyped, clearWidgets, dismiss, extractBackdrop, extractForeground, extractFrame, extractHeader, extractRenderState, getApplyButtonLabel, getCancelButtonLabel, getFocusedWidget, getHeaderRightPadding, getMaxDescriptionLines, getResetButtonLabel, init, initFooter, initHeaderWidgets, isInsideFrame, keyPressed, keyReleased, mouseClicked, mouseDragged, mouseReleased, mouseScrolled, onClose, removeWidget, setFocusedWidget, showCopyIdButton, showFooter, showResetButton, updateFooterButtonsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ConfigPopup
closeOnEscape, closeOnOutsideClick, isFocused, setFocused, tickMethods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
capturesInput, getBorderForArrowNavigation, getCurrentFocusPath, getRectangle, isMouseOver, mouseMoved, nextFocusPath, preeditUpdated, shouldTakeFocusAfterInteractionMethods inherited from interface net.minecraft.client.gui.components.TabOrderedElement
getTabOrderGroup
-
Field Details
-
VALID_TEXT_COLOR
protected static final int VALID_TEXT_COLOR- See Also:
-
INVALID_TEXT_COLOR
protected static final int INVALID_TEXT_COLOR- See Also:
-
INFO_TEXT_COLOR
protected static final int INFO_TEXT_COLOR- See Also:
-
workingText
-
lastAcceptedText
-
parsedValue
-
validationError
@Nullable protected @Nullable net.minecraft.network.chat.Component validationError -
editBox
protected net.minecraft.client.gui.components.EditBox editBox -
clearButton
protected net.minecraft.client.gui.components.Button clearButton
-
-
Constructor Details
-
TextDetailPopup
-
-
Method Details
-
validateInput
-
formatValue
-
getRegexFilter
-
getMaxLength
protected int getMaxLength() -
getRightInfoText
@Nullable protected @Nullable net.minecraft.network.chat.Component getRightInfoText() -
getDefaultInfoText
protected net.minecraft.network.chat.Component getDefaultInfoText() -
initExtraContent
protected void initExtraContent(int left, int top, int width, int height) -
onWorkingValueChanged
-
getPreferredWidth
protected int getPreferredWidth()- Overrides:
getPreferredWidthin classAbstractConfigPopup<T>
-
getPreferredHeight
protected int getPreferredHeight()- Overrides:
getPreferredHeightin classAbstractConfigPopup<T>
-
getDefaultValueTooltip
@Nullable protected @Nullable net.minecraft.network.chat.Component getDefaultValueTooltip()- Overrides:
getDefaultValueTooltipin classAbstractConfigPopup<T>
-
initContent
protected void initContent(int left, int top, int width, int height) Description copied from class:AbstractConfigPopupInitializes the popup's body widgets inside the provided inner content bounds.- Specified by:
initContentin classAbstractConfigPopup<T>
-
setWorkingText
-
revalidate
protected void revalidate(boolean notifySubclass) -
extractBody
protected void extractBody(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick) Description copied from class:AbstractConfigPopupRenders custom non-widget content inside the popup body (drawn beneath child widgets).- Overrides:
extractBodyin classAbstractConfigPopup<T>
-
isWorkingValueValid
protected boolean isWorkingValueValid()- Overrides:
isWorkingValueValidin classAbstractConfigPopup<T>
-
canResetWorkingValue
protected boolean canResetWorkingValue()- Overrides:
canResetWorkingValuein classAbstractConfigPopup<T>
-
resetWorkingValue
protected void resetWorkingValue()- Overrides:
resetWorkingValuein classAbstractConfigPopup<T>
-
buildResultValue
- Overrides:
buildResultValuein classAbstractConfigPopup<T>
-
trimToWidth
-