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 Summary
Modifier and TypeMethodDescriptiondefault 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, orOptional.empty()when this editor does not open a popup.voiddraw(net.minecraft.client.gui.GuiGraphicsExtractor 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.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, orOptional.empty()when this editor did not handle the click.intgetControlHeight(IConfigScreenValue<T> configValue, T value) The preferred height of the value control inside a config row.intgetControlWidth(IConfigScreenValue<T> configValue, T value) The preferred width of the value control inside a config row.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, orOptional.empty()to use the standard value info.
-
Method Details
-
getControlWidth
The preferred width of the value control inside a config row.- Parameters:
configValue- the config screen value being editedvalue- the currently displayed value, including pending edits- Returns:
- the preferred control width
- Since:
- 0.1.0
-
getControlHeight
The preferred height of the value control inside a config row.- Parameters:
configValue- the config screen value being editedvalue- the currently displayed value, including pending edits- Returns:
- the preferred control height
- Since:
- 0.1.0
-
draw
void draw(net.minecraft.client.gui.GuiGraphicsExtractor 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 contextarea- the control boundsconfigValue- the config screen value being editedvalue- the currently displayed value, including pending editshovered- true when the mouse is over the controlhasPendingChange- 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, orOptional.empty()to use the standard value info.- Parameters:
area- the control boundsconfigValue- the config screen value being editedvalue- the currently displayed value, including pending editshasPendingChange- true when the displayed value differs from the applied valuemouseX- the current mouse x-coordinatemouseY- 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, orOptional.empty()when this editor does not open a popup. The config GUI controls popup placement and clipping.- Parameters:
area- the control boundsconfigValue- the config screen value being editedvalue- the currently displayed value, including pending editsmouseX- the click x-coordinatemouseY- the click y-coordinatebutton- 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, orOptional.empty()when this editor did not handle the click.- Parameters:
area- the control boundsconfigValue- the config screen value being editedvalue- the currently displayed value, including pending editsmouseX- the click x-coordinatemouseY- the click y-coordinatebutton- the clicked mouse button- Returns:
- the clicked value
- Since:
- 0.1.0
-