Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into config-subcategory
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/com/gtnewhorizon/gtnhlib/config/ConfigurationManager.java
  • Loading branch information
Lyfts committed Sep 1, 2024
2 parents eef6f82 + 0b01adb commit e7e429c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 151 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static void registerConfig(Class<?> configClass) throws ConfigException {
val modid = cfg.modid();
val filename = Optional.of(cfg.filename().trim()).filter(s -> !s.isEmpty()).orElse(modid);

Configuration rawConfig = configs.computeIfAbsent(modid + "|" + filename, (ignored) -> {
Configuration rawConfig = configs.computeIfAbsent(getConfigKey(cfg), (ignored) -> {
Path newConfigDir = configDir;
if (!cfg.configSubDirectory().trim().isEmpty()) {
newConfigDir = newConfigDir.resolve(cfg.configSubDirectory().trim());
Expand Down Expand Up @@ -312,9 +312,7 @@ public static List<IConfigElement> getConfigElements(Class<?> configClass) throw
init();
val cfg = Optional.ofNullable(configClass.getAnnotation(Config.class)).orElseThrow(
() -> new ConfigException("Class " + configClass.getName() + " does not have a @Config annotation!"));
val modid = cfg.modid();
val filename = Optional.of(cfg.filename().trim()).filter(s -> !s.isEmpty()).orElse(modid);
val rawConfig = Optional.ofNullable(configs.get(modid + "|" + filename)).map(
val rawConfig = Optional.ofNullable(configs.get(getConfigKey(cfg))).map(
(conf) -> Optional.ofNullable(configToCategoryClassMap.get(conf))
.map((map) -> map.get(cfg.category().trim()).contains(configClass)).orElse(false) ? conf : null)
.orElseThrow(
Expand Down Expand Up @@ -344,9 +342,7 @@ public static List<IConfigElement> getConfigElements(Class<?> configClass) throw
public static List<IConfigElement> getCategorizedElements(Class<?> configClass) throws ConfigException {
val cfg = Optional.ofNullable(configClass.getAnnotation(Config.class)).orElseThrow(
() -> new ConfigException("Class " + configClass.getName() + " does not have a @Config annotation!"));;
val modid = cfg.modid();
val filename = Optional.of(cfg.filename().trim()).filter(s -> !s.isEmpty()).orElse(modid);
val rawConfig = Optional.ofNullable(configs.get(modid + "|" + filename)).map(
val rawConfig = Optional.ofNullable(configs.get(getConfigKey(cfg))).map(
(conf) -> Optional.ofNullable(configToCategoryClassMap.get(conf))
.map((map) -> map.get(cfg.category().trim()).contains(configClass)).orElse(false) ? conf : null)
.orElseThrow(
Expand Down Expand Up @@ -442,6 +438,10 @@ private static boolean isFieldSubCategory(Field field) {
&& fieldClass.getSuperclass().equals(Object.class);
}

private static String getConfigKey(Config cfg) {
return cfg.modid() + "|" + cfg.configSubDirectory() + "|" + cfg.filename();
}

private static File minecraftHome() {
return Launch.minecraftHome != null ? Launch.minecraftHome : new File(".");
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ public class TessellatorRedirectorTransformer implements IClassTransformer {

private static final String TessellatorClass = "net/minecraft/client/renderer/Tessellator";

private static final com.gtnewhorizon.gtnhlib.asm.ClassConstantPoolParser cstPoolParser = new ClassConstantPoolParser(
TessellatorClass);
private static final ClassConstantPoolParser cstPoolParser = new ClassConstantPoolParser(TessellatorClass);

private static final List<String> TransformerExclusions = Arrays.asList(
"org.lwjgl",
Expand Down

0 comments on commit e7e429c

Please sign in to comment.