跳到正文

Jsonate

作者:_nArUTo_

Jsonate simplifies Minecraft mod configuration with a lightweight JSON API, automating versioning, file handling, and type-safe data access for Forge developers.

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

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.


常见问题

Jsonate 支持哪些 Minecraft 版本?

Jsonate 支持 Minecraft Java 版 1.16.5–1.21.8,共 25 个版本,可用的加载器:Forge / NeoForge。下载时注意选择和你游戏版本一致的文件。

Jsonate 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Forge / NeoForge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。

评论

登录后评论和评分

_nArUTo_ 的其他作品

查看全部 →