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

public abstract class TextDetailPopup<T> extends AbstractConfigPopup<T>
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.
  • 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

      protected String workingText
    • lastAcceptedText

      protected String lastAcceptedText
    • parsedValue

      @Nullable protected T 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

      protected TextDetailPopup(ConfigScreen parentScreen, net.minecraft.client.Minecraft minecraft, Property<T> property, @Nullable @Nullable String initialText, boolean isLocked, Consumer<T> onApply)
  • Method Details

    • validateInput

      protected abstract TextDetailPopup.ValidationResult<T> validateInput(String text)
    • formatValue

      protected abstract String formatValue(T value)
    • getRegexFilter

      @Nullable protected @Nullable String 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

      protected void onWorkingValueChanged(@Nullable T newValue, boolean valid)
    • getPreferredWidth

      protected int getPreferredWidth()
      Overrides:
      getPreferredWidth in class AbstractConfigPopup<T>
    • getPreferredHeight

      protected int getPreferredHeight()
      Overrides:
      getPreferredHeight in class AbstractConfigPopup<T>
    • getDefaultValueTooltip

      @Nullable protected @Nullable net.minecraft.network.chat.Component getDefaultValueTooltip()
      Overrides:
      getDefaultValueTooltip in class AbstractConfigPopup<T>
    • initContent

      protected void initContent(int left, int top, int width, int height)
      Description copied from class: AbstractConfigPopup
      Initializes the popup's body widgets inside the provided inner content bounds.
      Specified by:
      initContent in class AbstractConfigPopup<T>
    • setWorkingText

      protected void setWorkingText(String newText)
    • 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: AbstractConfigPopup
      Renders custom non-widget content inside the popup body (drawn beneath child widgets).
      Overrides:
      extractBody in class AbstractConfigPopup<T>
    • isWorkingValueValid

      protected boolean isWorkingValueValid()
      Overrides:
      isWorkingValueValid in class AbstractConfigPopup<T>
    • canResetWorkingValue

      protected boolean canResetWorkingValue()
      Overrides:
      canResetWorkingValue in class AbstractConfigPopup<T>
    • resetWorkingValue

      protected void resetWorkingValue()
      Overrides:
      resetWorkingValue in class AbstractConfigPopup<T>
    • buildResultValue

      @Nullable protected T buildResultValue()
      Overrides:
      buildResultValue in class AbstractConfigPopup<T>
    • trimToWidth

      protected String trimToWidth(String text, int maxWidth)