Load merged plugin file

This commit is contained in:
ah-OOG-ah committed 2025-06-20 11:46:48 -04:00
1 parent b51a23affb
commit b9951f7fc6
2 files changed
+12 -7

No files matched your search

+3
View File
@@ -37,6 +37,9 @@ tasks.shadowJar {
// Merge mcmod.info files
transform(McmodInfoMerger("unimixins"))
// Merge list of coremods
append("META-INF/EmbeddedFMLCorePlugins.txt")
}
tasks.jar {
@@ -17,18 +17,20 @@ public class AllCore implements IFMLLoadingPlugin {
private static final List<Class<?>> embeddedCorePluginClasses = new ArrayList<>();
private static final List<IFMLLoadingPlugin> embeddedCorePluginInstances = new ArrayList<>();
private static final URL embeddedCorePluginsFile = AllCore.class.getResource("/META-INF/unimixins-all.EmbeddedFMLCorePlugins.txt");
private static final URL embeddedCorePluginsFile = AllCore.class.getResource("/META-INF/EmbeddedFMLCorePlugins.txt");
static {
try {
final String embeddedPlugins = embeddedCorePluginsFile != null
? IOUtils.toString(embeddedCorePluginsFile)
: "";
for (String s : embeddedPlugins.split(" ")) {
// The file contains a duplicate, and I can't be bothered to remove it at build time.
final HashSet<String> embeddedPlugins = (embeddedCorePluginsFile == null)
? new HashSet<>()
: new HashSet<>(Arrays.asList(IOUtils.toString(embeddedCorePluginsFile).split("\n")));
for (String s : embeddedPlugins) {
Class<?> cls = Class.forName(s);
embeddedCorePluginClasses.add(cls);
}
} catch(Exception e) {
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@@ -38,7 +40,7 @@ public class AllCore implements IFMLLoadingPlugin {
for (Class<?> cls : embeddedCorePluginClasses) {
try {
embeddedCorePluginInstances.add((IFMLLoadingPlugin)cls.newInstance());
embeddedCorePluginInstances.add((IFMLLoadingPlugin) cls.newInstance());
} catch (Exception e) {
throw new RuntimeException(e);
}