Merge devcompat module into compat

It was kept separate to make it easy to apply the dev compat tweaks in dev
environments without having to mess with config files, but this is unnecessary
now that you can set config values via JVM flags.
This commit is contained in:
makamys committed 2023-10-21 11:50:16 +02:00
1 parent ddd608a8f8
commit 7ee32c62d3
10 files changed
+19 -130

No files matched your search

@@ -1,5 +1,7 @@
package io.github.legacymoddingmc.unimixins.common.config;
import net.minecraft.launchwrapper.Launch;
import java.io.*;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -9,6 +11,8 @@ import java.lang.reflect.Field;
import java.util.*;
public class AnnotatedProperties {
public static final boolean DEV_ENVIRONMENT = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
public static void load(File file, Class<?> cls) {
PropertyCollection properties = PropertyCollection.fromFile(file);
@@ -19,6 +23,9 @@ public class AnnotatedProperties {
List<String> comment = new ArrayList<>(Arrays.asList(ann.com().split("\n")));
String def = ann.def();
String cat = ann.cat();
boolean devOnly = ann.devOnly();
if(devOnly && !DEV_ENVIRONMENT) continue;
comment.removeIf(s -> s.startsWith("[default:"));
comment.add("[default: " + def + "]");
@@ -68,6 +75,8 @@ public class AnnotatedProperties {
String com() default "";
/** Category (the property name gets prefixed with this) */
String cat();
/** If true, the config will only appear in dev environments */
boolean devOnly() default false;
}
}