88 lines
2.2 KiB
Markdown
88 lines
2.2 KiB
Markdown
|
# 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:
|
||
|
|
||
|
settings.gradle:
|
||
|
```groovy
|
||
|
pluginManagement {
|
||
|
repositories {
|
||
|
maven {
|
||
|
name = 'JF Commons'
|
||
|
url = 'https://gitlab.com/api/v4/projects/35745143/packages/maven'
|
||
|
}
|
||
|
maven {
|
||
|
name = 'LibJF'
|
||
|
url = 'https://gitlab.com/api/v4/projects/25805200/packages/maven'
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
```
|
||
|
|
||
|
build.gradle:
|
||
|
```groovy
|
||
|
plugins {
|
||
|
id 'io.gitlab.jfronny.libjf.libjf-config-compiler-plugin' version 'VERSION'
|
||
|
}
|
||
|
|
||
|
repositories {
|
||
|
maven { url 'https://gitlab.com/api/v4/projects/25805200/packages/maven' }
|
||
|
}
|
||
|
|
||
|
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}")
|
||
|
|
||
|
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-config-reflect-v1:${project.libjf_version}")
|
||
|
}
|
||
|
|
||
|
task injectCompiledConfig(type: io.gitlab.jfronny.libjf.config.plugin.ConfigInjectTask, dependsOn: jar) {
|
||
|
from jar
|
||
|
modId = archivesBaseName
|
||
|
archiveClassifier = 'config-inject'
|
||
|
destinationDirectory = file("${project.buildDir}/devlibs")
|
||
|
}
|
||
|
|
||
|
remapJar {
|
||
|
dependsOn injectCompiledConfig
|
||
|
input = injectCompiledConfig.archiveFile
|
||
|
}
|
||
|
|
||
|
loom {
|
||
|
mods {
|
||
|
register(name, {
|
||
|
sourceSet sourceSets.main
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
```
|
||
|
|
||
|
fabric.mod.json:
|
||
|
```json
|
||
|
{
|
||
|
"entrypoints": {
|
||
|
"libjf:config": ["Your config class here"]
|
||
|
}
|
||
|
}
|
||
|
```
|
||
|
|
||
|
Config class:
|
||
|
```java
|
||
|
@JfConfig
|
||
|
public class ConfigExample {
|
||
|
@Entry public static boolean someEntry = true;
|
||
|
}
|
||
|
```
|
||
|
|
||
|
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.
|