Respect config entry order, use terraformers archive maven, simplify translation keys

This commit is contained in:
JFronny 2021-07-11 21:26:14 +02:00
parent 1c0ee05a6a
commit bfaa448b73
No known key found for this signature in database
GPG Key ID: BEC5ACBBD4EE17E5
10 changed files with 28 additions and 25 deletions

View File

@ -1,7 +1,7 @@
apply from: "https://gitlab.com/-/snippets/2121059/raw/master/jfbase.gradle" apply from: "https://gitlab.com/-/snippets/2121059/raw/master/jfbase.gradle"
repositories { repositories {
maven { url = "https://maven.terraformersmc.com/"; name = "ModMenu" } maven { url = "https://raw.githubusercontent.com/TerraformersMC/Archive/main/releases/"; name = "ModMenu" }
maven { url = "https://maven.shedaniel.me/"; name = "Cloth Config" } maven { url = "https://maven.shedaniel.me/"; name = "Cloth Config" }
maven { url = "https://maven.dblsaiko.net/"; name = "Canvas" } maven { url = "https://maven.dblsaiko.net/"; name = "Canvas" }
maven { url = 'https://server.bbkr.space/artifactory/libs-release'; name = "Required for canvas" } maven { url = 'https://server.bbkr.space/artifactory/libs-release'; name = "Required for canvas" }

View File

@ -6,7 +6,7 @@ minecraft_version=1.17.1
yarn_mappings=build.1 yarn_mappings=build.1
loader_version=0.11.6 loader_version=0.11.6
# Mod Properties # Mod Properties
mod_version=2.2.0 mod_version=2.3.0
maven_group=io.gitlab.jfronny maven_group=io.gitlab.jfronny
archives_base_name=respackopts archives_base_name=respackopts

View File

@ -1,10 +1,10 @@
{ {
"respackopts.title.lumi": "Lumi Lights", "rpo.lumi": "Lumi Lights",
"respackopts.field.lumi.tonemap": "Tonemap mode", "rpo.lumi.tonemap": "Tonemap mode",
"respackopts.tooltip.lumi.tonemap": "Tooltip test", "rpo.tooltip.lumi.tonemap": "Tooltip test",
"respackopts.field.lumi.pbr": "Enable PBR", "rpo.lumi.pbr": "Enable PBR",
"respackopts.field.lumi.debugMode": "Debug Mode", "rpo.lumi.debugMode": "Debug Mode",
"respackopts.field.lumi.debugMode.normal": "Normal Mode", "rpo.lumi.debugMode.normal": "Normal Mode",
"respackopts.field.lumi.waterVertexWavy": "Wavy water model", "rpo.lumi.waterVertexWavy": "Wavy water model",
"respackopts.tooltip.lumi.subcategoryTest.sliderTest": "Yayyy" "rpo.tooltip.lumi.subcategoryTest.sliderTest": "Yayyy"
} }

View File

@ -1,9 +1,9 @@
{ {
"respackopts.title.lumi": "Not Lumi Lights", "rpo.lumi": "Not Lumi Lights",
"respackopts.field.lumi.tonemap": "Not Tonemap mode", "rpo.lumi.tonemap": "Not Tonemap mode",
"respackopts.tooltip.lumi.tonemap": "Not Tooltip test", "rpo.tooltip.lumi.tonemap": "Not Tooltip test",
"respackopts.field.lumi.pbr": "Not Enable PBR", "rpo.lumi.pbr": "Not Enable PBR",
"respackopts.field.lumi.debugMode": "Not Debug Mode", "rpo.lumi.debugMode": "Not Debug Mode",
"respackopts.field.lumi.waterVertexWavy": "Not Wavy water model", "rpo.lumi.waterVertexWavy": "Not Wavy water model",
"respackopts.tooltip.lumi.subcategoryTest.sliderTest": "Not Yayyy" "rpo.tooltip.lumi.subcategoryTest.sliderTest": "Not Yayyy"
} }

View File

@ -1,6 +1,6 @@
{ {
"id": "lumi", "id": "lumi",
"version": 1, "version": 2,
"conf": { "conf": {
"tonemap": [ "tonemap": [
"default", "default",

View File

@ -23,11 +23,11 @@ public class GuiFactory {
ConfigEntry<?> entry = in.getValue(); ConfigEntry<?> entry = in.getValue();
String entryName = ("".equals(namePrefix) ? "" : namePrefix + ".") + in.getKey(); String entryName = ("".equals(namePrefix) ? "" : namePrefix + ".") + in.getKey();
Respackopts.LOGGER.info(entryName); Respackopts.LOGGER.info(entryName);
String translationPrefix = "respackopts." + entry.getEntryType() + "." + screenId; String translationPrefix = (source.getVersion() < 3 ? "respackopts." + entry.getEntryType() + "." : "rpo.") + screenId;
config.accept(entry.buildEntry(entryBuilder, config.accept(entry.buildEntry(entryBuilder,
getText(entryName, translationPrefix), getText(entryName, translationPrefix),
() -> { () -> {
String k = "respackopts.tooltip." + screenId + "." + entryName; String k = (source.getVersion() < 3 ? "respackopts.tooltip." : "rpo.tooltip.") + screenId + "." + entryName;
if (Language.getInstance().hasTranslation(k)) { if (Language.getInstance().hasTranslation(k)) {
Text[] res = new Text[1]; Text[] res = new Text[1];
res[0] = new TranslatableText(k); res[0] = new TranslatableText(k);

View File

@ -27,7 +27,7 @@ import java.util.Set;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class Respackopts implements ClientModInitializer { public class Respackopts implements ClientModInitializer {
public static final Integer META_VERSION = 2; public static final Integer META_VERSION = 3;
public static final String ID = "respackopts"; public static final String ID = "respackopts";
public static final Identifier CONF_ID = new Identifier(ID, "conf.json"); public static final Identifier CONF_ID = new Identifier(ID, "conf.json");
public static final Logger LOGGER = LogManager.getFormatterLogger(ID); public static final Logger LOGGER = LogManager.getFormatterLogger(ID);

View File

@ -8,14 +8,14 @@ import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
import me.shedaniel.clothconfig2.impl.builders.SubCategoryBuilder; import me.shedaniel.clothconfig2.impl.builders.SubCategoryBuilder;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import java.util.HashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.function.Supplier; import java.util.function.Supplier;
public class ConfigBranch extends ConfigEntry<Map<String, ConfigEntry<?>>> { public class ConfigBranch extends ConfigEntry<Map<String, ConfigEntry<?>>> {
public ConfigBranch() { public ConfigBranch() {
setValue(new HashMap<>()); setValue(new LinkedHashMap<>());
} }
public boolean getBoolean(String name) throws RpoError { public boolean getBoolean(String name) throws RpoError {

View File

@ -16,6 +16,9 @@ public abstract class ConfigEntry<T> {
public void setVersion(int version) { public void setVersion(int version) {
this.version = version; this.version = version;
} }
public int getVersion() {
return version;
}
public T getValue() { public T getValue() {
if (value == null) { if (value == null) {

View File

@ -1,6 +1,6 @@
{ {
"respackopts.loadFailed": "Failed to load resourcepacks", "respackopts.loadFailed": "Failed to load resource packs",
"respackopts.loadError": "There is an issue with the resourcepack configs. Please take a look at the game log", "respackopts.loadError": "There is an issue with the resource pack configs. Please take a look at the game log",
"respackopts.configure": "Configure", "respackopts.configure": "Configure",
"respackopts.mainconfig": "ResPackOpts", "respackopts.mainconfig": "ResPackOpts",
"respackopts.invalid": "Invalid value", "respackopts.invalid": "Invalid value",