允许在任何时间点设置 Forge 配置。特别是对于在 coremod / tweaker 的加载阶段使用 Forge 配置系统的开发人员。
开发用法:
- 添加 CleanroomMC 的存储库并依赖于 ConfigAnytime 的 Maven 条目:
repositories {
maven {
url 'https://maven.cleanroommc.com'
}
}
dependencies {
implementation 'com.cleanroommc:configanytime:1.0'
}
- API 用法示例:
@Config(modid = "configanytime")
public class ConfigClass {
public static boolean configBooleanProperty = true;
public static int configIntProperty = 42;
// Static initializers go after the properties!
// This will run automatically when you retrieve any properties from this config class
static {
ConfigAnytime.register(ConfigClass.class);
}
}