Class ConfigurationScreen
java.lang.Object
net.minecraft.client.gui.components.events.AbstractContainerEventHandler
net.minecraft.client.gui.screens.Screen
net.minecraft.client.gui.screens.options.OptionsSubScreen
net.neoforged.neoforge.client.gui.ConfigurationScreen
- All Implemented Interfaces:
ContainerEventHandler
,GuiEventListener
,Renderable
,TabOrderedElement
A generic configuration UI.
and return your own screen from the TriFunction. For the latter,
use either the 2-argument constructor
For extending the system, see the documentation on
This class is the entry point for NeoForge's generic configuration UI. You can use this in two different ways:
- As an entry point for your custom configuration screen that handles fetching your configs, matching
ModConfig.Type
to the current game, enforcing level and game restarts, etc. - As a ready-made system but extensible that works out of the box with all configs that use the
ModConfigSpec
system and don't do anything overly weird with it.
invalid reference
#ConfigurationScreen(ModContainer, Screen, TriFunction)
ConfigurationScreen(ModContainer, Screen)
if you don't need to extend the system, or the 3-argument one and return a subclass of
ConfigurationScreen.ConfigurationSectionScreen
from the TriFunction.In any case, register your configuration screen in your client mod class like this:
@Mod(value = "examplemod", dist = Dist.CLIENT)
public class ExampleMod {
public ExampleMod(ModContainer container) {
container.registerExtensionPoint(IConfigScreenFactory.class, (mc, parent) -> new ConfigurationScreen(container, parent));
}
}
ConfigurationScreen.ConfigurationSectionScreen
.
If you only want to suppress certain elements from being displayed, you can also supply a ConfigurationScreen.ConfigurationSectionScreen.Filter
as the third parameter instead of subclassing the whole ConfigurationScreen.ConfigurationSectionScreen
.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A UI screen that presents a list-type configuration value and allows the user to edit it, including an unlimited undo system and reset to default.static class
A UI screen that presents a single section of configuration values and allows the user to edit them, including an unlimited undo system and reset to default.private static final class
static class
static final class
A class representing an undo/redo buffer.Nested classes/interfaces inherited from class net.minecraft.client.gui.screens.Screen
Screen.NarratableSearchResult
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
static final int
private static final String
static final Component
The breadcrumb separator.private static final MutableComponent
A literal to create an empty line in a tooltip.private static final String
How the filename will be added to the tooltip.private static final ChatFormatting
static final Component
static final Component
static final Component
private static final String
Prefix for static keys the configuration screens use internally.private static final String
The label of list elements.static final Component
protected final net.neoforged.fml.ModContainer
static final Component
static final Component
static final Component
private static final String
How the range will be added to the tooltip when using translated tooltips.private static final ChatFormatting
static final Component
static final Component
static final Component
static final Component
static final Component
static final Component
static final Component
private static final String
A wrapper for the labels of buttons that open a new screen.private static final String
A default for the labels of buttons that open a new screen.private final PropertyDispatch.QuadFunction
<ConfigurationScreen, net.neoforged.fml.config.ModConfig.Type, net.neoforged.fml.config.ModConfig, Component, Screen> static final Component
static final Component
static final Component
static final Component
static final Component
protected static final ConfigurationScreen.TranslationChecker
static final Component
static final Component
static final Component
Fields inherited from class net.minecraft.client.gui.screens.options.OptionsSubScreen
lastScreen, layout, list, options
Fields inherited from class net.minecraft.client.gui.screens.Screen
CUBE_MAP, font, FOOTER_SEPARATOR, HEADER_SEPARATOR, height, INWORLD_FOOTER_SEPARATOR, INWORLD_HEADER_SEPARATOR, MENU_BACKGROUND, minecraft, narratorButton, PANORAMA, renderables, screenExecutor, title, width
Fields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS
-
Constructor Summary
ConstructorsConstructorDescriptionConfigurationScreen
(net.neoforged.fml.ModContainer mod, Screen parent) ConfigurationScreen
(net.neoforged.fml.ModContainer mod, Screen parent, PropertyDispatch.QuadFunction<ConfigurationScreen, net.neoforged.fml.config.ModConfig.Type, net.neoforged.fml.config.ModConfig, Component, Screen> sectionScreen) ConfigurationScreen
(net.neoforged.fml.ModContainer mod, Screen parent, ConfigurationScreen.ConfigurationSectionScreen.Filter filter) -
Method Summary
Modifier and TypeMethodDescriptionvoid
added()
protected void
void
onClose()
private void
translatableConfig
(net.neoforged.fml.config.ModConfig modConfig, String suffix, String fallback) Methods inherited from class net.minecraft.client.gui.screens.options.OptionsSubScreen
addContents, addFooter, addTitle, init, removed, repositionElements
Methods inherited from class net.minecraft.client.gui.screens.Screen
addRenderableOnly, addRenderableWidget, addWidget, afterKeyboardAction, afterMouseAction, afterMouseMove, changeFocus, children, clearFocus, clearTooltipForNextRenderPass, clearWidgets, findNarratableWidget, getBackgroundMusic, getMinecraft, getNarrationMessage, getRectangle, getTitle, getTooltipFromItem, getUsageNarration, handleComponentClicked, handleDelayedNarration, hasAltDown, hasControlDown, hasShiftDown, init, insertText, isCopy, isCut, isMouseOver, isPaste, isPauseScreen, isSelectAll, isValidCharacterForName, keyPressed, onFilesDrop, rebuildWidgets, removeWidget, render, renderBackground, renderBlurredBackground, renderMenuBackground, renderMenuBackground, renderMenuBackgroundTexture, renderPanorama, renderTransparentBackground, renderWithTooltip, resize, setInitialFocus, setInitialFocus, setTooltipForNextRenderPass, setTooltipForNextRenderPass, setTooltipForNextRenderPass, setTooltipForNextRenderPass, shouldCloseOnEsc, shouldNarrateNavigation, tick, triggerImmediateNarration, updateNarratedWidget, updateNarrationState, updateNarratorStatus, wrapScreenError
Methods inherited from class net.minecraft.client.gui.components.events.AbstractContainerEventHandler
getFocused, isDragging, setDragging, setFocused
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.client.gui.components.events.ContainerEventHandler
charTyped, getChildAt, getCurrentFocusPath, isFocused, keyReleased, mouseClicked, mouseDragged, mouseReleased, mouseScrolled, nextFocusPath, setFocused
Methods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
mouseMoved
Methods inherited from interface net.minecraft.client.gui.components.TabOrderedElement
getTabOrderGroup
-
Field Details
-
LANG_PREFIX
Prefix for static keys the configuration screens use internally.- See Also:
-
SECTION
A wrapper for the labels of buttons that open a new screen. Default: "%s..."- See Also:
-
SECTION_TEXT
A default for the labels of buttons that open a new screen. Default: "Edit"- See Also:
-
CRUMB_SEPARATOR
The breadcrumb separator. Default: "%s > %s" -
CRUMB
- See Also:
-
LIST_ELEMENT
The label of list elements. Will be supplied the index into the list. Default: "%s:"- See Also:
-
RANGE_TOOLTIP
How the range will be added to the tooltip when using translated tooltips. Mimics what the comment does in ModConfigSpec.- See Also:
-
RANGE_TOOLTIP_STYLE
-
FILENAME_TOOLTIP
How the filename will be added to the tooltip.- See Also:
-
FILENAME_TOOLTIP_STYLE
-
EMPTY_LINE
A literal to create an empty line in a tooltip. -
TOOLTIP_CANNOT_EDIT_THIS_WHILE_ONLINE
-
TOOLTIP_CANNOT_EDIT_THIS_WHILE_OPEN_TO_LAN
-
TOOLTIP_CANNOT_EDIT_NOT_LOADED
-
NEW_LIST_ELEMENT
-
MOVE_LIST_ELEMENT_UP
-
MOVE_LIST_ELEMENT_DOWN
-
REMOVE_LIST_ELEMENT
-
UNSUPPORTED_ELEMENT
-
LONG_STRING
-
GAME_RESTART_TITLE
-
GAME_RESTART_MESSAGE
-
GAME_RESTART_YES
-
SERVER_RESTART_TITLE
-
SERVER_RESTART_MESSAGE
-
RETURN_TO_MENU
-
SAVING_LEVEL
-
RESTART_NO
-
RESTART_NO_TOOLTIP
-
UNDO
-
UNDO_TOOLTIP
-
RESET
-
RESET_TOOLTIP
-
BIG_BUTTON_WIDTH
public static final int BIG_BUTTON_WIDTH- See Also:
-
translationChecker
-
mod
protected final net.neoforged.fml.ModContainer mod -
sectionScreen
private final PropertyDispatch.QuadFunction<ConfigurationScreen,net.neoforged.fml.config.ModConfig.Type, sectionScreennet.neoforged.fml.config.ModConfig, Component, Screen> -
needsRestart
-
autoClose
private boolean autoClose
-
-
Constructor Details
-
ConfigurationScreen
-
ConfigurationScreen
public ConfigurationScreen(net.neoforged.fml.ModContainer mod, Screen parent, ConfigurationScreen.ConfigurationSectionScreen.Filter filter) -
ConfigurationScreen
public ConfigurationScreen(net.neoforged.fml.ModContainer mod, Screen parent, PropertyDispatch.QuadFunction<ConfigurationScreen, net.neoforged.fml.config.ModConfig.Type, net.neoforged.fml.config.ModConfig, Component, Screen> sectionScreen)
-
-
Method Details
-
addOptions
protected void addOptions()- Specified by:
addOptions
in classOptionsSubScreen
-
translatableConfig
-
added
public void added() -
onClose
public void onClose()- Overrides:
onClose
in classOptionsSubScreen
-
onDisconnect
private void onDisconnect()
-