ElytraF5 & more · API 1
API referenceTypes and contracts
All public types are in net.turtle.ef5am.api.client.settings. The API is provided by the client source set.
ElytraF5SettingsApi
| Member | Behavior |
|---|---|
API_VERSION | Current compatibility constant: 1. |
registerCategory(category) | Registers a category during client initialization. Throws if an ID is malformed or already registered, or if options fail validation. |
registeredCategories() | Returns a snapshot of categories registered so far. |
SettingsCategory
SettingsCategory(
id: String,
title: Component,
options: List<SettingsOption>,
icon: Identifier? = null
)- id: namespaced identifier, e.g.
examplemod:visuals. Namespace allows lowercase letters, numbers,_ . -; path also allows/. - title: category label, preferably
Component.translatable(...). - options: ordered list of setting rows.
- icon: optional 16 × 16 texture identifier, e.g.
Identifier.fromNamespaceAndPath("examplemod", "textures/gui/settings.png").
Common SettingsOption fields
Every option has an ID unique within its category, a title and a description. The description is shown as a tooltip; use a translatable component.
BooleanSettingOption
BooleanSettingOption(
id, title, description,
currentValue: () -> Boolean,
onChanged: (Boolean) -> Unit
)The currentValue provider is read when the screen is created. Your callback should update your in-memory config value.
ChoiceSettingOption
ChoiceSettingOption(
id, title, description,
choices: List<SettingsChoice>,
currentChoice: () -> String,
onChanged: (String) -> Unit
)
SettingsChoice(id: String, title: Component)Choice IDs must be unique, and currentChoice() must match one registered choice when the category is registered. The button displays the choice title, while the callback receives its ID.
ActionSettingOption
ActionSettingOption(
id, title, description,
buttonTitle: Component,
action: (Screen) -> Unit
)The callback receives the current ElytraF5 screen. Pass it as the parent screen when opening a child screen so the back action returns to the right place.
Validation and limits
- Category IDs are globally unique; option IDs are unique within their category.
- Option IDs accept lowercase letters, digits,
.,_and-. - A choice selector must have at least one choice and may not contain duplicate IDs.
- A missing or unavailable icon uses a fallback icon.
- Additional categories and long option lists can be reached by scrolling.
- Value providers and callbacks remain owned by the contributing mod; the API does not serialize your config.