QoLib
Shared utilities for Quantum8060's Fabric mods.
Client Config API
The first QoLib API is a client-only JSON config store. Its public types do not expose Minecraft classes, so consumer mods may use either Mojang or Yarn mappings.
private static final ConfigValue<Boolean> ENABLED = ConfigValue.booleanValue("enabled", false);
private static final ClientConfig CONFIG = ClientConfig.builder("viewer-mod")
.add(ENABLED)
.build();
// In ClientModInitializer#onInitializeClient:
CONFIG.load();
ENABLED.set(true);
CONFIG.save();
Supported value types are boolean, ranged integer, ranged decimal, string, and enum.
Config files are stored at config/<mod-id>.json. Invalid or missing fields use their
declared defaults. Saving uses a temporary file and atomic replacement when available.
The API keeps persistence separate from the settings screen, so values can also be changed through key bindings or other client logic.
Settings screen
Use config.screen("Title") to define categories, toggles, sliders, numeric fields,
and action buttons. build(parent) returns a Screen for a Mod Menu config-screen
factory. The screen stages changes until Save; Cancel leaves the config intact.
The search box searches labels and descriptions across every category.
return CONFIG.screen("Viewer Mod")
.category("general", "General", menu -> menu
.toggle("Enabled", "Save received chunks", ENABLED)
.integerSlider("Radius", "Chunks to capture", RADIUS, 1, 16)
.integerField("Maximum files", "Archive limit", MAX_FILES))
.category("tools", "Tools", menu -> menu
.button("Clear cache", "Deletes the local cache", ViewerCache::clear))
.build(parent);