Download Sodium Options API — Minecraft Mods — MetaMods
Sodium Options API

Sodium Options API

Active

Downloads

1

Last update

6 months ago

Versions

1.20 — 1.21.5
Client
Fabric
Forge
Neoforge
Decor
Libraries
Game optimization
Utils

Sodium Options API

Cross-Platform Compatibility for Settings

This library provides unified events for integration with Sodium and Embeddium settings menus across different platforms. For example, with a single call you can add a settings page for Embeddium on Forge, Fabric Sodium 0.5 on version 1.20.1, and Fabric/NeoForge Sodium 0.6 on 1.21.1:

OptionGUIConstruction.EVENT.register((pages) -> pages.add(new TestOptionPage()));

API integration

Enhanced Interface for Players

If you're an end user and don't have this library as a dependency of another Sodium mod yet – install it together with Reese's Sodium Options. This will provide an enhanced categories menu with dropdown support, which significantly simplifies navigation. These improvements work even for mods that directly inject into Sodium settings without using this API.

menu example

Compatibility and Integration

The mod is partially based on the Embeddium categories API and settings events, but with substantial changes to support upstream Sodium. To ensure compatibility, changes to the Reese's Sodium Options menu are implemented through mixins, so both mods need to be installed.

Working with the API

To get started, add the library to your development environment via Maven:

modImplementation("maven.modrinth:sodium-options-api:version")
// comment: Replace "version" with the actual version number

The library provides three main events in the toni.sodiumoptionsapi.api package:

  • OptionGUIConstruction.EVENT – called once when creating the settings interface, allows adding entire pages (most likely what you need) AtOptionPageConstruction.EVENT– called for each settings page, useful for adding a group of toggles to the performance tab @OptionGroupConstruction.EVENT – called for each option group, can be used to insert a single setting into an existing group
Project members
Txni

Txni

Developer

Created: 20 Sep 2024

ID: 59633