2022-08-27 20:17:13 +02:00
|
|
|
# About
|
|
|
|
LibJF Config is a modular config library.
|
|
|
|
Generally, using a combination of its modules is recommended.
|
|
|
|
On the following pages, the modules of libjf-config are explained in more detail.
|
|
|
|
If you just want to get started, a quick setup example for a client-side mod using the compiler plugin can be seen below:
|
|
|
|
|
|
|
|
build.gradle:
|
|
|
|
```groovy
|
|
|
|
repositories {
|
2022-11-25 14:57:40 +01:00
|
|
|
maven { url 'https://maven.frohnmeyer-wds.de/artifacts' }
|
2022-08-27 20:17:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
include modImplementation("io.gitlab.jfronny.libjf:libjf-config-core-v1:${project.libjf_version}")
|
|
|
|
include modRuntimeOnly("io.gitlab.jfronny.libjf:libjf-config-ui-tiny-v1:${project.libjf_version}")
|
|
|
|
include("io.gitlab.jfronny.libjf:libjf-base:${project.libjf_version}")
|
|
|
|
|
2022-12-29 13:31:08 +01:00
|
|
|
annotationProcessor("io.gitlab.jfronny.libjf:libjf-config-compiler-plugin-v2:${project.libjf_version}")
|
2022-08-27 20:17:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
loom {
|
|
|
|
mods {
|
|
|
|
register(name, {
|
|
|
|
sourceSet sourceSets.main
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2022-12-29 13:31:08 +01:00
|
|
|
|
|
|
|
compileJava {
|
|
|
|
options.compilerArgs << "-AmodId=" + archivesName // optionally fill in your mod id explicitly
|
|
|
|
}
|
2022-08-27 20:17:13 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
fabric.mod.json:
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"entrypoints": {
|
2022-12-29 13:31:08 +01:00
|
|
|
"libjf:config": ["some.package.JFC_YourConfigClass"] // The JFC_ prefix is for the config-compiler-plugin-v2-generated classes
|
2022-08-27 20:17:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Config class:
|
|
|
|
```java
|
|
|
|
@JfConfig
|
|
|
|
public class ConfigExample {
|
|
|
|
@Entry public static boolean someEntry = true;
|
2022-12-29 13:31:08 +01:00
|
|
|
|
|
|
|
static {
|
|
|
|
JFC_ConfigExample.ensureInitialized();
|
|
|
|
}
|
2022-08-27 20:17:13 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
en_us.json:
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"modid.jfconfig.title": "Your Mod",
|
|
|
|
"modid.jfconfig.someEntry": "Some Entry",
|
|
|
|
"modid.jfconfig.someEntry.tooltip": "Some comment"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
I also recommend adding [ModMenu](https://github.com/TerraformersMC/ModMenu/wiki/API) in order to more easily test your config in dev.
|