Layout Config Screen
Added: 1.0.0
An interface representing a layout config screen.
While it is mostly for internal use by FramingLib (and implemented by FramingLayoutConfigScreen), you can use it to interact with the current screen state.
For example, you can query whether the layout is edited via isEdited() inside an afterInitConsumer callback to change UI logic dynamically.
Methods
| Return Type | Signature |
|---|---|
| void | setSavingRunnable(@Nullable Runnable runnable) |
| void | setAfterInitConsumer(@Nullable Consumer<Screen> afterInitConsumer) |
| ResourceLocation | getBackgroundTexture() |
| List<LayoutElement> | getLayoutElementList() |
| boolean | isEdited() |
| boolean | isNotDefault() |
| void | saveAll(boolean openOtherScreens) |
| void | resetAll() |
| void | quit() |
| void | setTooltip(Component tooltip) |
setSavingRunnable
Added: 1.0.0
Sets the callback action that executes immediately when the Save button is pressed.
Pass your serialization code.
Pass null to remove the runnable.
null by default.
setAfterInitConsumer
Added: 1.0.0
Sets the callback action that executes immediately after the screen finishes initialization. Provides the screen instance as a parameter.
Pass null to remove the consumer.
null by default.
⚠️️ Certain actions such as resizing the window will reinitialize the screen, so the after init consumer may run multiple times on a screen
getBackgroundTexture
Added: 1.0.0
Returns the ResourceLocation identifier pointing to the texture file used as the screen's rendering background pattern.
The dirt background is used by default.
getLayoutElementList
Added: 1.0.0
Returns a list containing all LayoutElement instances currently registered on this config screen.
isEdited
Added: 1.0.0
Returns true if any LayoutElement's values are different from when the screen was initialized.
isNotDefault
Added: 1.0.0
Returns true if any LayoutElement's values are different from their default values. Requires LayoutElements to have a set default value.
saveAll
Added: 1.0.0
Saves the value of every LayoutElement instance, then executes the saving runnable.
If openOtherScreens is set to true, closes the screen and opens the parent screen afterwards.
resetAll
Added: 1.0.0
Resets every LayoutElements' value back to their default values. Requires LayoutElements to have a set default value.
quit
Added: 1.0.0
Closes the screen and opens the parent screen.
setTooltip
Added: 1.0.0
Updates the active tooltip component displayed when cursor tracking interacts.
⚠️️ The tooltip gets reset every frame