diff --git a/common/src/main/java/com/dfsek/terra/config/loaders/mod/ModDependentConfigSectionLoader.java b/common/src/main/java/com/dfsek/terra/config/loaders/mod/ModDependentConfigSectionLoader.java index 6c5901768..7bf8baca2 100644 --- a/common/src/main/java/com/dfsek/terra/config/loaders/mod/ModDependentConfigSectionLoader.java +++ b/common/src/main/java/com/dfsek/terra/config/loaders/mod/ModDependentConfigSectionLoader.java @@ -23,13 +23,21 @@ public class ModDependentConfigSectionLoader implements TypeLoader map = (Map) c; + if(c instanceof Map && ((Map) c).containsKey("default")) { + Map map = (Map) c; - ModDependentConfigSection configSection = new ModDependentConfigSection<>(main, loader.loadType(generic, map.get("default"))); + ModDependentConfigSection configSection = new ModDependentConfigSection<>(main, loader.loadType(generic, map.get("default"))); - ((Map) ((Map) c).get("mods")).forEach(configSection::add); + if(map.containsKey("mods")) { + for(Map.Entry modEntry : ((Map) map.get("mods")).entrySet()) { + configSection.add(modEntry.getKey(), loader.loadType(generic, modEntry.getValue())); + } + } - return configSection; + return configSection; + } else { + return ModDependentConfigSection.withDefault(loader.loadType(generic, c)); // Load the original type otherwise. + } } else throw new LoadException("Unable to load config! Could not retrieve parameterized type: " + type); } }