LibJF/docs/config
JFronny ac374ca790
All checks were successful
ci/woodpecker/push/docs Pipeline was successful
ci/woodpecker/push/jfmod Pipeline was successful
ci/woodpecker/tag/docs Pipeline was successful
ci/woodpecker/tag/jfmod Pipeline was successful
[docs] Update for compiler plugin v2
2022-12-29 13:31:08 +01:00
..
libjf-config-commands-v1.md [docs] Move to mdbook and document libjf-config v1 modules 2022-08-27 20:17:13 +02:00
libjf-config-compiler-plugin-v2.md [docs] Update for compiler plugin v2 2022-12-29 13:31:08 +01:00
libjf-config-core-v1.md [docs] Move to mdbook and document libjf-config v1 modules 2022-08-27 20:17:13 +02:00
libjf-config-reflect-v1.md [docs] Update for compiler plugin v2 2022-12-29 13:31:08 +01:00
libjf-config-ui-tiny-v1.md [docs] Move to mdbook and document libjf-config v1 modules 2022-08-27 20:17:13 +02:00
README.md [docs] Update for compiler plugin v2 2022-12-29 13:31:08 +01: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:

repositories {
    maven { url 'https://maven.frohnmeyer-wds.de/artifacts' }
}

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}")

    annotationProcessor("io.gitlab.jfronny.libjf:libjf-config-compiler-plugin-v2:${project.libjf_version}")
}

loom {
    mods {
        register(name, {
            sourceSet sourceSets.main
        })
    }
}

compileJava {
    options.compilerArgs << "-AmodId=" + archivesName // optionally fill in your mod id explicitly
}

fabric.mod.json:

{
  "entrypoints": {
    "libjf:config": ["some.package.JFC_YourConfigClass"] // The JFC_ prefix is for the config-compiler-plugin-v2-generated classes
  }
}

Config class:

@JfConfig
public class ConfigExample {
    @Entry public static boolean someEntry = true;
    
    static {
        JFC_ConfigExample.ensureInitialized();
    }
}

en_us.json:

{
  "modid.jfconfig.title": "Your Mod",
  "modid.jfconfig.someEntry": "Some Entry",
  "modid.jfconfig.someEntry.tooltip": "Some comment"
}

I also recommend adding ModMenu in order to more easily test your config in dev.