i just had a stupid idea
hacky minecraft mixin that enables "hierarchical lang files"
so instead of
{
"item.botania.black_lotus": "Black Lotus",
"item.botania.blacker_lotus": "Blacker Lotus"
}
you get something like
{
"item": {
"botania": {
"black_lotus": "Black Lotus",
"blacker_lotus": "Blacker Lotus"
}
}
}
- Depend on this as a mod.
- Use your beautiful hierarchical lang jsons.
blursed: datagenerator that just takes the below and transforms it into the above at build time
that's actually real easy i think
- Depend on JsonFlattener at build/datagen time.
- Flatten your generated or handwritten Json using the
flatten
method of JsonFlattener.
Alternatively, use the Gradle plugin:
- Apply the plugin:
plugins {
id("com.github.eutro.hierarchical-lang") version "<version>"
}
flattenJson
any lang files:
- Kotlin
tasks.processResources {
filesMatching("**/lang/*.json") {
flattenJson(this)
}
}
- Groovy
tasks.processResources {
filesMatching("**/lang/*.json") {
flattenJson.invoke(it)
}
}
...it does mean that datapackers don't get the same luxury though
- Run
flattener-<version>-<expander|flattener>-cli.jar
from your own build, or from the releases.- Options:
-i
,-in
or-input
- Set the input file. Reads from stdin otherwise.-o
,-out
or-output
- Set the output file. Writes to stdout otherwise.-pp
or-pretty-print"
- Pretty-print the Json output.-lenient
- Make the parser more liberal in what it accepts.-non-executable
- Generate non-executable Json.-no-html-escapes
- Disable escaping of<
,>
,&
,=
and'
.-cs
or-charset
- Set the charset. Applies for future-i
s and-o
s, or for stdio.
- Options: