截图
介绍
介绍由机器翻译自 Modrinth 原页面,仅供参考。
- 跨版本、易于移植的配置工具,依赖极少
- 专注于易用性和可移植性
- 之所以叫 Cryonic,是因为它酷得不得了
功能说明
- 它会将 JSON 文件以“mod_id.json”的形式存储在 {minecraft_dir}/config 中
- 所有配置文件都会在早期初始化阶段通过“cryonicconfig.json”中的字典读取
- 配置只能通过直接编辑 JSON 文件进行修改,暂无制作 GUI 配置界面的计划
- 为了便于移植,同步变量会直接通过聊天发送给玩家,并进行拦截
- 使用 HashMap 查找 Str 到 ConfigStorage 以及 Str 到 Obj(变量)的映射
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,)"
Slainlight 的其他作品
查看全部 →Chisel Reborn [Forge/Fabric/NeoForge]
by Slaincow, Slainlight
添加了新方块!
2477万
1 个月前
CurseForge
Factory Blocks [Forge/Fabric/NeoForge]
by Slaincow, ConvexBurrito5 等
为凿子重制版的方块添加了工厂方块的附加内容
1897万
1 个月前
CurseForge
Chisel Reborn
by Slainlight
Adds lots of blocks that are variations of vanilla blocks
158.2万
1 个月前
Modrinth

评论
登录后评论和评分