Jsonate - Evil Json dominates everything.
Jsonate provides an intuitive, lightweight API for managing JSON-based configuration files in your Minecraft mods. Designed for simplicity and efficiency, it handles versioning, automatic file creation, and data type conversions seamlessly.
Don't wanna add dependency? Just copy the JsonConfig class and paste it into your template!
🛠 Usage Example
Add settings to your mod with clean, readable code:
public class ExampleMod {
private static final JsonConfig CONFIG = JsonConfig.create("your_mod_id", "1.0.0")
.put("Difficulty", 3)
.put("EnableFeatures", true)
.put("BlockList", Arrays.asList("dirt", "sand"))
.initialize(); // Creates/loads JSON file
// Access values statically
public static int DIFFICULTY = CONFIG.getInt("Difficulty");
public static boolean FEATURES_ENABLED = CONFIG.getBoolean("EnableFeatures");
public static List<String> BLOCKED_ITEMS = CONFIG.getList("BlockList", String.class);
}
Generated JSON (your_mod_id.json):
{
"Version": "1.0.0",
"Difficulty": 3,
"EnableFeatures": true,
"BlockList": ["dirt", "sand"]
}
⚠ Important Notes
Cache Config Values: For performance, store retrieved values in static fields (avoid repeated lookups).
Path Conventions: Files are saved to .minecraft/config/your_mod_id.json by default.
Version Control: Update the version number after changing .put logic.