LibJF/docs/config
Johannes Frohnmeyer 09466ce897
chore: clean up config modules
2023-08-30 14:14:20 +02:00
..
README.md chore: clean up config modules 2023-08-30 14:14:20 +02:00
libjf-config-commands.md chore: clean up config modules 2023-08-30 14:14:20 +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-v2.md chore: clean up config modules 2023-08-30 14:14:20 +02:00
libjf-config-ui-tiny.md chore: clean up config modules 2023-08-30 14:14:20 +02:00

README.md

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-v2:${project.libjf_version}")
    include modRuntimeOnly("io.gitlab.jfronny.libjf:libjf-config-ui-tiny:${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.