Interface IConfigValueEditor<T>

Type Parameters:
T - the config value type edited by this control

public interface IConfigValueEditor<T>
Custom value editor for compact config controls that need specialized rendering or click handling.
Since:
0.1.0
  • Method Details

    • getControlWidth

      int getControlWidth(IConfigScreenValue<T> configValue, T value)
      The preferred width of the value control inside a config row.
      Parameters:
      configValue - the config screen value being edited
      value - the currently displayed value, including pending edits
      Returns:
      the preferred control width
      Since:
      0.1.0
    • getControlHeight

      int getControlHeight(IConfigScreenValue<T> configValue, T value)
      The preferred height of the value control inside a config row.
      Parameters:
      configValue - the config screen value being edited
      value - the currently displayed value, including pending edits
      Returns:
      the preferred control height
      Since:
      0.1.0
    • draw

      void draw(net.minecraft.client.gui.GuiGraphics guiGraphics, net.minecraft.client.renderer.Rect2i area, IConfigScreenValue<T> configValue, T value, boolean hovered, boolean hasPendingChange)
      Draw the value control inside the given row area.
      Parameters:
      guiGraphics - the draw context
      area - the control bounds
      configValue - the config screen value being edited
      value - the currently displayed value, including pending edits
      hovered - true when the mouse is over the control
      hasPendingChange - true when the displayed value differs from the applied value
      Since:
      0.1.0
    • getTooltipInfo

      Optional<ConfigInfo> getTooltipInfo(net.minecraft.client.renderer.Rect2i area, IConfigScreenValue<T> configValue, T value, boolean hasPendingChange, double mouseX, double mouseY)
      Get info for the current mouse position, or Optional.empty() to use the standard value info.
      Parameters:
      area - the control bounds
      configValue - the config screen value being edited
      value - the currently displayed value, including pending edits
      hasPendingChange - true when the displayed value differs from the applied value
      mouseX - the current mouse x-coordinate
      mouseY - the current mouse y-coordinate
      Returns:
      the info to show
      Since:
      0.1.0
    • createPopup

      default Optional<IConfigValuePopup<T>> createPopup(net.minecraft.client.renderer.Rect2i area, IConfigScreenValue<T> configValue, T value, double mouseX, double mouseY, int button)
      Create a popup for a mouse click, or Optional.empty() when this editor does not open a popup. The config GUI controls popup placement and clipping.
      Parameters:
      area - the control bounds
      configValue - the config screen value being edited
      value - the currently displayed value, including pending edits
      mouseX - the click x-coordinate
      mouseY - the click y-coordinate
      button - the clicked mouse button
      Returns:
      the popup to open
      Since:
      0.1.0
    • getClickedValue

      default Optional<T> getClickedValue(net.minecraft.client.renderer.Rect2i area, IConfigScreenValue<T> configValue, T value, double mouseX, double mouseY, int button)
      Get the value selected by a mouse click, or Optional.empty() when this editor did not handle the click.
      Parameters:
      area - the control bounds
      configValue - the config screen value being edited
      value - the currently displayed value, including pending edits
      mouseX - the click x-coordinate
      mouseY - the click y-coordinate
      button - the clicked mouse button
      Returns:
      the clicked value
      Since:
      0.1.0