Class OptionEntry<T, W extends net.minecraft.client.gui.components.AbstractWidget>

java.lang.Object
net.minecraft.client.gui.components.ContainerObjectSelectionList.Entry<AbstractConfigEntry>
johnsmith.configoverhauled.api.client.gui.entry.AbstractConfigEntry
johnsmith.configoverhauled.impl.client.gui.entry.OptionEntry<T,W>
All Implemented Interfaces:
ConfigEntry, net.minecraft.client.gui.components.events.ContainerEventHandler, net.minecraft.client.gui.components.events.GuiEventListener, net.minecraft.client.gui.components.TabOrderedElement, net.minecraft.client.gui.layouts.LayoutElement
Direct Known Subclasses:
AbstractRegistryEntry, AbstractTextEntry, BooleanEntry, EnumEntry

public abstract class OptionEntry<T, W extends net.minecraft.client.gui.components.AbstractWidget> extends AbstractConfigEntry implements ConfigEntry
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final @Nullable net.minecraft.client.gui.components.Button
     
    protected final boolean
     
    protected final net.minecraft.network.chat.Component
     
    protected final net.minecraft.client.Minecraft
     
    protected final Runnable
     
    protected final ConfigScreen
     
    protected final Property<T>
     
    protected final net.minecraft.client.gui.components.Button
     
    protected final List<net.minecraft.util.FormattedCharSequence>
     
    protected final W
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    OptionEntry(Property<T> property, ConfigScreen parentScreen, net.minecraft.client.Minecraft minecraft, Runnable onValueChanged)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    @NotNull List<? extends net.minecraft.client.gui.components.events.GuiEventListener>
     
    protected net.minecraft.client.gui.components.Button
     
    protected abstract W
     
    static boolean
    determineLockState(net.minecraft.client.Minecraft minecraft, Property<?> property)
     
    void
    extractContent(@NotNull net.minecraft.client.gui.GuiGraphicsExtractor guiGraphicsExtractor, int mouseX, int mouseY, boolean isHovering, float partialTick)
     
    protected net.minecraft.network.chat.Component
     
    protected net.minecraft.network.chat.Component
     
    protected net.minecraft.network.chat.Component
     
    protected int
    getMaxLabelWidth(int widgetX)
     
    protected boolean
    Whether this entry exposes a 20x20 square detail-editor button to the left of its primary widget.
    boolean
     
    boolean
    Evaluates if the current UI state differs from the property's defaultValue().
    boolean
    Evaluates if the widget matches the current search bar query.
    @NotNull List<? extends net.minecraft.client.gui.narration.NarratableEntry>
     
    protected void
    Opens the detailed modal editor popup for this entry via ConfigScreen.openPopup(ConfigPopup).
    void
    Restores the bound property to its defaultValue() and updates the UI state.
    protected void
    setValue(T newValue)
     
    protected void
     
    protected abstract void
     

    Methods inherited from class net.minecraft.client.gui.components.ContainerObjectSelectionList.Entry

    focusPathAtIndex, getFocused, isDragging, mouseClicked, nextFocusPath, setDragging, setFocused

    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.ContainerEventHandler

    charTyped, getBorderForArrowNavigation, getChildAt, getCurrentFocusPath, isFocused, keyPressed, keyReleased, mouseDragged, mouseReleased, mouseScrolled, preeditUpdated, setFocused

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

    getRectangle, isMouseOver, mouseMoved, shouldTakeFocusAfterInteraction

    Methods inherited from interface net.minecraft.client.gui.layouts.LayoutElement

    setPosition

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

    getTabOrderGroup
  • Field Details

    • parentScreen

      protected final ConfigScreen parentScreen
    • property

      protected final Property<T> property
    • resetButton

      protected final net.minecraft.client.gui.components.Button resetButton
    • detailButton

      @Nullable protected final @Nullable net.minecraft.client.gui.components.Button detailButton
    • widget

      protected final W extends net.minecraft.client.gui.components.AbstractWidget widget
    • labelComponent

      protected final net.minecraft.network.chat.Component labelComponent
    • tooltip

      protected final List<net.minecraft.util.FormattedCharSequence> tooltip
    • minecraft

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

      protected final Runnable onValueChanged
    • isLocked

      protected final boolean isLocked
  • Constructor Details

    • OptionEntry

      public OptionEntry(Property<T> property, ConfigScreen parentScreen, net.minecraft.client.Minecraft minecraft, Runnable onValueChanged)
  • Method Details

    • hasDetailPopup

      protected boolean hasDetailPopup()
      Whether this entry exposes a 20x20 square detail-editor button to the left of its primary widget.

      Invoked during OptionEntry construction; subclasses overriding this method should return a constant value without depending on subclass fields initialized after super(...).

    • openDetailPopup

      protected void openDetailPopup()
      Opens the detailed modal editor popup for this entry via ConfigScreen.openPopup(ConfigPopup).
    • createDetailButton

      protected net.minecraft.client.gui.components.Button createDetailButton()
    • getDetailButtonLabel

      protected net.minecraft.network.chat.Component getDetailButtonLabel()
    • getDetailButtonTooltip

      protected net.minecraft.network.chat.Component getDetailButtonTooltip()
    • matchesSearch

      public boolean matchesSearch(String query)
      Description copied from interface: ConfigEntry
      Evaluates if the widget matches the current search bar query.
      Specified by:
      matchesSearch in interface ConfigEntry
    • resetToDefault

      public void resetToDefault()
      Description copied from interface: ConfigEntry
      Restores the bound property to its defaultValue() and updates the UI state.
      Specified by:
      resetToDefault in interface ConfigEntry
    • isModified

      public boolean isModified()
      Description copied from interface: ConfigEntry
      Evaluates if the current UI state differs from the property's defaultValue().
      Specified by:
      isModified in interface ConfigEntry
    • determineLockState

      public static boolean determineLockState(net.minecraft.client.Minecraft minecraft, Property<?> property)
    • createWidget

      protected abstract W createWidget()
    • updateWidgetValue

      protected abstract void updateWidgetValue()
    • setValue

      protected void setValue(T newValue)
    • isDefault

      public boolean isDefault()
    • canReset

      public boolean canReset()
    • updateResetButton

      protected void updateResetButton()
    • getDefaultValueTooltip

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

      protected int getMaxLabelWidth(int widgetX)
    • extractContent

      public void extractContent(@NotNull @NotNull net.minecraft.client.gui.GuiGraphicsExtractor guiGraphicsExtractor, int mouseX, int mouseY, boolean isHovering, float partialTick)
    • children

      @NotNull public @NotNull List<? extends net.minecraft.client.gui.components.events.GuiEventListener> children()
      Specified by:
      children in interface net.minecraft.client.gui.components.events.ContainerEventHandler
    • narratables

      @NotNull public @NotNull List<? extends net.minecraft.client.gui.narration.NarratableEntry> narratables()
      Specified by:
      narratables in class net.minecraft.client.gui.components.ContainerObjectSelectionList.Entry<AbstractConfigEntry>