-
Notifications
You must be signed in to change notification settings - Fork 0
Home
GMalvestiti edited this page Aug 31, 2026
·
6 revisions
Lite Config is a JSON5/TOML config library for Minecraft mods on Fabric and NeoForge. You just need to annotate a
Java class with @Config, hand it to a builder, and get back a ConfigHolder that handles
file path resolution, read/write operations, corrupt-file recovery, copies, validation, and
lifecycle events.
What Lite Config does:
- Configuration data layer: Lite Config handles config files, including paths, loading, saving, default values, corruption recovery, atomic writes, and JSON5/TOML formats.
- Safe state management: provides validated snapshots, copies, runtime updates, and custom state cloning.
- Async and read-only configs: choose synchronous, asynchronous, or read-only holders depending on your threading and lifecycle needs.
- Restart guards: block local runtime updates and defer synchronized changes of restart-aware fields.
-
Custom update API:
updateandupdateAndSavereturn anUpdateResultwith acceptance status and validation violations. - Fine-grained failure policies: independently control how read, write, and update failures are handled, from graceful fallback to strict exceptions.
- Lifecycle and event listeners: hook into config load, save, and update events, or use config-level hooks for normalization and validation.
- Declared constraints: bound numbers, strings, and collections with annotations enforced on load and update and exposed through metadata.
- Config metadata: query every field's path, type, default, comment, translation key, and constraints at runtime.
- Opt-in sync: mark a config or individual field as synced and Lite Config automatically keeps those values synchronized from server to client.
- Versioning and migrations: stamp a revision into the file and upgrade older ones step by step instead of losing the player's values.
- Customizable entries: control file paths, field names, comments, ignored fields, and other persistence details.
Outside Lite Config's scope:
- Config screen: Lite Config is a data layer and it does not render UI by itself.