Jsonate - JSON Takes Control Over Everything
Jsonate provides a simple and convenient API for working with JSON configurations in Minecraft mods. This lightweight library automates version management, file creation, and data type conversion, making the mod configuration process highly efficient.
Don't want to add a dependency? Simply copy the JsonConfig class and paste it into your project!
🛠 Usage Example
Add settings to your mod using clean and understandable 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 through static fields
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 Recommendations
Value Caching: For better performance, store retrieved values in static fields (avoid repeated configuration lookups).
File Paths: By default, files are saved to .minecraft/config/your_mod_id.json
.
Version Control: Update the version number after changing the .put
method logic.