添加 Maven 仓库:
跨版本易于移植的配置工具,依赖极少 专门针对易用性和可移植性 因其酷到爆而命名为 Cryonic 功能说明 此工具会将 JSON 文件存储在 {minecraft_dir}/config 目录下,文件名为 "mod_id.json" 所有配置文件将在早期初始化阶段通过 "cryonicconfig.json" 中的字典进行读取 配置只能通过直接编辑 JSON 文件进行修改,暂无图形界面配置计划 为了便于移植,同步的变量会直接发送到玩家聊天窗口,并进行拦截处理 使用哈希映射来查找字符串到 ConfigStorage 以及字符串到对象(变量)的对应关系 API Groovy (build.gradle) 添加依赖 添加 Maven 仓库: repositories { maven { url " https://api.modrinth.com/maven " } } Modern/Architectury 风格: 如果仅使用 Fabric 或 NeoForge,请将 ${project.name} 替换为 fabric , forge , neoforge dependencies { modImplementation "maven.modrinth:cryonicconfig:fabric-${project.name}:1.0.0+mc${rootProject.minecraft_version}" } b1.7.3: dependencies { modImplementation "maven.modrinth:cryonicconfig:babric:1.0.0+mcb1.7.3" } 简单用法: // You can store or use on the fly, this can be called anywhere ConfigStorage config = CryonicConfig.getConfig("mod_id"); // You can store ints, doubles, booleans, and strings // By getting them, you are setting their default value too // getter format (variable name, default value) // You cannot reuse variable names! They will be overridden. config.getInt("varName", 3); config.getDouble("name", 3.3); config.getBoolean("var", true); config.getString("str", "Geronimo!") // The variable will exist locally on client and server // If you want a connected server player to use a server config // You must call, making client use the server's value config.sync("varName", playerEntity); // Feel free to use this format: CryonicConfig.getConfig("mod_id").getInt("varName", 3); // You can set variables manually, instead of letting get generate them // This is also useful for overriding old values config.setInt("varName", 3); config.setDouble("name", 3.3); config.setBoolean("var", true); config.setString("str", "Geronimo!"); 标记依赖 在 fabric.mod.json : { "depends": { "cryonicconfig": "*" } } 中 mods.toml / neoforge.mods.toml : [[dependencies.cryonicconfig]] modId = "cryonicconfig" type = "required" versionRange = "[0,)"
在鱼乐云资源中心浏览该资源,登录后可一键安装到你的游戏服务器。