From 7b75ff2fae759226446776db10a9defbea418e61 Mon Sep 17 00:00:00 2001 From: Su5eD Date: Mon, 25 Dec 2023 13:21:53 +0100 Subject: [PATCH 1/2] Allow mods to provide module descriptors --- .../fml/javafmlmod/FMLModContainer.java | 5 +- loader/build.gradle | 1 + .../loading/moddiscovery/ModJarMetadata.java | 62 ++++++++++++++++--- 3 files changed, 57 insertions(+), 11 deletions(-) diff --git a/languages/java/src/main/java/net/neoforged/fml/javafmlmod/FMLModContainer.java b/languages/java/src/main/java/net/neoforged/fml/javafmlmod/FMLModContainer.java index e0f40c7c2..683a96f4d 100644 --- a/languages/java/src/main/java/net/neoforged/fml/javafmlmod/FMLModContainer.java +++ b/languages/java/src/main/java/net/neoforged/fml/javafmlmod/FMLModContainer.java @@ -54,8 +54,9 @@ public FMLModContainer(IModInfo info, String className, ModFileScanData modFileS this.contextExtension = () -> contextExtension; try { - var layer = gameLayer.findModule(info.getOwningFile().moduleName()).orElseThrow(); - modClass = Class.forName(layer, className); + var moduleName = info.getOwningFile().getFile().getSecureJar().moduleDataProvider().descriptor().name(); + var module = gameLayer.findModule(moduleName).orElseThrow(); + modClass = Class.forName(module, className); LOGGER.trace(LOADING,"Loaded modclass {} with {}", modClass.getName(), modClass.getClassLoader()); } catch (Throwable e) diff --git a/loader/build.gradle b/loader/build.gradle index ace9f37d8..8e2afc2df 100644 --- a/loader/build.gradle +++ b/loader/build.gradle @@ -19,6 +19,7 @@ dependencies { api("com.mojang:logging:${mojang_logging_version}") api "net.neoforged:JarJarSelector:${jarjar_version}" api "net.neoforged:JarJarMetadata:${jarjar_version}" + api("cpw.mods:securejarhandler:${securejarhandler_version}") implementation("net.sf.jopt-simple:jopt-simple:${jopt_simple_version}") implementation("cpw.mods:securejarhandler:${securejarhandler_version}") diff --git a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModJarMetadata.java b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModJarMetadata.java index 2eb443b15..b5313fb98 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModJarMetadata.java +++ b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModJarMetadata.java @@ -8,12 +8,18 @@ import cpw.mods.jarhandling.JarContents; import cpw.mods.jarhandling.JarMetadata; import cpw.mods.jarhandling.LazyJarMetadata; +import cpw.mods.jarhandling.SecureJar; +import cpw.mods.jarhandling.impl.ModuleJarMetadata; import net.neoforged.neoforgespi.locating.IModFile; import java.lang.module.ModuleDescriptor; import java.util.Objects; +import java.util.Optional; public final class ModJarMetadata extends LazyJarMetadata implements JarMetadata { + private static final String MODULE_INFO = "module-info.class"; + private static final String AUTOMATIC_MODULE_NAME = "Automatic-Module-Name"; + private final JarContents jarContents; private IModFile modFile; @@ -27,7 +33,7 @@ public void setModFile(IModFile file) { @Override public String name() { - return modFile.getModFileInfo().moduleName(); + return descriptor().name(); } @Override @@ -37,14 +43,39 @@ public String version() { @Override public ModuleDescriptor computeDescriptor() { - var bld = ModuleDescriptor.newAutomaticModule(name()) - .version(version()) - .packages(jarContents.getPackagesExcluding("assets", "data")); - jarContents.getMetaInfServices().stream() - .filter(p -> !p.providers().isEmpty()) - .forEach(p -> bld.provides(p.serviceName(), p.providers())); - modFile.getModFileInfo().usesServices().forEach(bld::uses); - return bld.build(); + SecureJar secureJar = modFile.getSecureJar(); + // Try reading descriptor from module-info.class first + SecureJar.ModuleDataProvider provider = secureJar.moduleDataProvider(); + return provider.findFile(MODULE_INFO) + .map(uri -> { + // Use ModuleJarMetadata to read the descriptor + JarMetadata metadata = new ModuleJarMetadata(uri, () -> jarContents.getPackagesExcluding("assets", "data")); + ModuleDescriptor jarDescriptor = metadata.descriptor(); + // Convert descriptor to builder + var builder = wrapDescriptor(jarDescriptor) + // Use version from mod metadata + .version(version()); + return builder.build(); + }) + // If the jar does not contain a module descriptor, we build one ourselves + .orElseGet(() -> { + // Use Automatic-Module-Name first, fallback to modid + var name = Optional.ofNullable(provider.getManifest().getMainAttributes().getValue(AUTOMATIC_MODULE_NAME)) + .orElseGet(() -> modFile.getModFileInfo().moduleName()); + // Build module descriptor as automatic module. This ensures the module is open, exports all packages and mutually reads all other modules. + var bld = ModuleDescriptor.newAutomaticModule(name) + // Use version from mod metadata + .version(version()) + // Add all packages + .packages(jarContents.getPackagesExcluding("assets", "data")); + // Add service providers + jarContents.getMetaInfServices().stream() + .filter(p -> !p.providers().isEmpty()) + .forEach(p -> bld.provides(p.serviceName(), p.providers())); + // Add used services from mod metadata + modFile.getModFileInfo().usesServices().forEach(bld::uses); + return bld.build(); + }); } public IModFile modFile() { @@ -68,4 +99,17 @@ public int hashCode() { public String toString() { return "ModJarMetadata[" +"modFile=" + modFile + ']'; } + + // Create a module descriptor builder from an existing descriptor, allowing us to modify and re-build it + private ModuleDescriptor.Builder wrapDescriptor(ModuleDescriptor descriptor) { + var builder = ModuleDescriptor.newModule(descriptor.name(), descriptor.modifiers()); + builder.packages(descriptor.packages()); + descriptor.version().ifPresent(builder::version); + descriptor.requires().forEach(builder::requires); + descriptor.exports().forEach(builder::exports); + descriptor.opens().forEach(builder::opens); + descriptor.uses().forEach(builder::uses); + descriptor.provides().forEach(builder::provides); + return builder; + } } From 589abd7b59b43d7b4e1f9097d148330efcae860c Mon Sep 17 00:00:00 2001 From: Su5eD Date: Mon, 25 Dec 2023 13:48:43 +0100 Subject: [PATCH 2/2] Add module declarations --- build.gradle | 1 - core/build.gradle | 1 + core/src/main/java/module-info.java | 27 +++++++ earlydisplay/src/main/java/module-info.java | 18 +++++ ...forged.fml.loading.ImmediateWindowProvider | 1 - events/src/main/java/module-info.java | 14 ++++ languages/java/src/main/java/module-info.java | 17 +++++ ....neoforgespi.language.IModLanguageProvider | 1 - .../lowcode/src/main/java/module-info.java | 16 +++++ ....neoforgespi.language.IModLanguageProvider | 1 - .../minecraft/src/main/java/module-info.java | 12 ++++ ....neoforgespi.language.IModLanguageProvider | 1 - loader/build.gradle | 2 + loader/src/main/java/module-info.java | 71 +++++++++++++++++++ .../loading/targets/CommonLaunchHandler.java | 2 +- .../targets/FMLClientLaunchHandler.java | 2 +- .../targets/FMLServerLaunchHandler.java | 2 +- ...mods.modlauncher.api.ILaunchHandlerService | 8 --- ...w.mods.modlauncher.api.INameMappingService | 1 - ...ods.modlauncher.api.ITransformationService | 1 - ...odlauncher.serviceapi.ILaunchPluginService | 3 - ...er.serviceapi.ITransformerDiscoveryService | 2 - ...ed.neoforgespi.locating.IDependencyLocator | 1 - ...neoforged.neoforgespi.locating.IModLocator | 6 -- spi/src/main/java/module-info.java | 13 ++++ 25 files changed, 194 insertions(+), 30 deletions(-) create mode 100644 core/src/main/java/module-info.java create mode 100644 earlydisplay/src/main/java/module-info.java delete mode 100644 earlydisplay/src/main/resources/META-INF/services/net.neoforged.fml.loading.ImmediateWindowProvider create mode 100644 events/src/main/java/module-info.java create mode 100644 languages/java/src/main/java/module-info.java delete mode 100644 languages/java/src/main/resources/META-INF/services/net.neoforged.neoforgespi.language.IModLanguageProvider create mode 100644 languages/lowcode/src/main/java/module-info.java delete mode 100644 languages/lowcode/src/main/resources/META-INF/services/net.neoforged.neoforgespi.language.IModLanguageProvider create mode 100644 languages/minecraft/src/main/java/module-info.java delete mode 100644 languages/minecraft/src/main/resources/META-INF/services/net.neoforged.neoforgespi.language.IModLanguageProvider create mode 100644 loader/src/main/java/module-info.java delete mode 100644 loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.api.ILaunchHandlerService delete mode 100644 loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.api.INameMappingService delete mode 100644 loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.api.ITransformationService delete mode 100644 loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.serviceapi.ILaunchPluginService delete mode 100644 loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.serviceapi.ITransformerDiscoveryService delete mode 100644 loader/src/main/resources/META-INF/services/net.neoforged.neoforgespi.locating.IDependencyLocator delete mode 100644 loader/src/main/resources/META-INF/services/net.neoforged.neoforgespi.locating.IModLocator create mode 100644 spi/src/main/java/module-info.java diff --git a/build.gradle b/build.gradle index 6b50fc0d6..1d53c1c73 100644 --- a/build.gradle +++ b/build.gradle @@ -63,7 +63,6 @@ subprojects { subProject -> manifest.attributes( 'Git-Commit' : gradleutils.gitInfo.abbreviatedId, 'Build-Number': "${subProject.version}", - 'Automatic-Module-Name' : "fml_${subProject.name.replace("-", "_")}", 'FMLModType' : subProject.name.startsWith("language") ? 'LANGPROVIDER' : subProject.name == "events" ? 'GAMELIBRARY' : 'LIBRARY', 'Specification-Title' : "FML${subProject.name}", 'Specification-Vendor' : 'NeoForged', diff --git a/core/build.gradle b/core/build.gradle index 5595f5fe8..8fa5a89c7 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -6,4 +6,5 @@ dependencies { api("net.neoforged:bus:${eventbus_version}") implementation("commons-io:commons-io:${commons_io_version}") + implementation("org.slf4j:slf4j-api:${slf4j_api_version}") } \ No newline at end of file diff --git a/core/src/main/java/module-info.java b/core/src/main/java/module-info.java new file mode 100644 index 000000000..de020cb8e --- /dev/null +++ b/core/src/main/java/module-info.java @@ -0,0 +1,27 @@ +open module net.neoforged.fancymodloader.core { + requires com.electronwill.nightconfig.core; + requires com.electronwill.nightconfig.toml; + requires com.google.common; + requires com.google.gson; + requires cpw.mods.modlauncher; + requires java.net.http; + requires logging; + requires maven.artifact; + requires net.neoforged.bus; + requires net.neoforged.neoforgespi; + requires net.neoforged.mergetool.api; + requires net.neoforged.fancymodloader.loader; + requires org.apache.commons.io; + requires org.apache.logging.log4j; + requires org.slf4j; + requires static org.jetbrains.annotations; + + exports net.neoforged.fml; + exports net.neoforged.fml.config; + exports net.neoforged.fml.event; + exports net.neoforged.fml.util; + exports net.neoforged.fml.util.thread; + + uses net.neoforged.fml.IModStateProvider; + uses net.neoforged.fml.IBindingsProvider; +} \ No newline at end of file diff --git a/earlydisplay/src/main/java/module-info.java b/earlydisplay/src/main/java/module-info.java new file mode 100644 index 000000000..362116409 --- /dev/null +++ b/earlydisplay/src/main/java/module-info.java @@ -0,0 +1,18 @@ +open module net.neoforged.fancymodloader.earlydisplay { + requires java.desktop; + requires java.management; + requires jdk.management; + requires jopt.simple; + requires net.neoforged.fancymodloader.loader; + requires org.lwjgl.glfw; + requires org.lwjgl.opengl; + requires org.lwjgl.stb; + requires org.lwjgl.tinyfd; + requires org.slf4j; + requires static org.jetbrains.annotations; + + exports net.neoforged.fml.earlydisplay; + + provides net.neoforged.fml.loading.ImmediateWindowProvider with + net.neoforged.fml.earlydisplay.DisplayWindow; +} \ No newline at end of file diff --git a/earlydisplay/src/main/resources/META-INF/services/net.neoforged.fml.loading.ImmediateWindowProvider b/earlydisplay/src/main/resources/META-INF/services/net.neoforged.fml.loading.ImmediateWindowProvider deleted file mode 100644 index 6f3868fae..000000000 --- a/earlydisplay/src/main/resources/META-INF/services/net.neoforged.fml.loading.ImmediateWindowProvider +++ /dev/null @@ -1 +0,0 @@ -net.neoforged.fml.earlydisplay.DisplayWindow \ No newline at end of file diff --git a/events/src/main/java/module-info.java b/events/src/main/java/module-info.java new file mode 100644 index 000000000..e6a3efed3 --- /dev/null +++ b/events/src/main/java/module-info.java @@ -0,0 +1,14 @@ +open module net.neoforged.fancymodloader.events { + requires net.neoforged.fancymodloader.core; + requires net.neoforged.mergetool.api; + requires net.neoforged.fancymodloader.loader; + requires cpw.mods.modlauncher; + requires net.neoforged.bus; + + exports net.neoforged.fml.core; + exports net.neoforged.fml.event.config; + exports net.neoforged.fml.event.lifecycle; + + provides net.neoforged.fml.IModStateProvider with + net.neoforged.fml.core.ModStateProvider; +} \ No newline at end of file diff --git a/languages/java/src/main/java/module-info.java b/languages/java/src/main/java/module-info.java new file mode 100644 index 000000000..23a34f647 --- /dev/null +++ b/languages/java/src/main/java/module-info.java @@ -0,0 +1,17 @@ +open module net.neoforged.fancymodloader.language.java { + requires cpw.mods.modlauncher; + requires cpw.mods.securejarhandler; + requires net.neoforged.bus; + requires net.neoforged.neoforgespi; + requires net.neoforged.mergetool.api; + requires net.neoforged.fancymodloader.core; + requires net.neoforged.fancymodloader.loader; + requires org.apache.logging.log4j; + requires org.objectweb.asm; + + exports net.neoforged.fml.common; + exports net.neoforged.fml.javafmlmod; + + provides net.neoforged.neoforgespi.language.IModLanguageProvider with + net.neoforged.fml.javafmlmod.FMLJavaModLanguageProvider; +} \ No newline at end of file diff --git a/languages/java/src/main/resources/META-INF/services/net.neoforged.neoforgespi.language.IModLanguageProvider b/languages/java/src/main/resources/META-INF/services/net.neoforged.neoforgespi.language.IModLanguageProvider deleted file mode 100644 index 7def367f8..000000000 --- a/languages/java/src/main/resources/META-INF/services/net.neoforged.neoforgespi.language.IModLanguageProvider +++ /dev/null @@ -1 +0,0 @@ -net.neoforged.fml.javafmlmod.FMLJavaModLanguageProvider diff --git a/languages/lowcode/src/main/java/module-info.java b/languages/lowcode/src/main/java/module-info.java new file mode 100644 index 000000000..60c871183 --- /dev/null +++ b/languages/lowcode/src/main/java/module-info.java @@ -0,0 +1,16 @@ +open module net.neoforged.fancymodloader.language.lowcode { + requires cpw.mods.modlauncher; + requires logging; + requires net.neoforged.bus; + requires net.neoforged.neoforgespi; + requires net.neoforged.fancymodloader.core; + requires net.neoforged.fancymodloader.loader; + requires org.apache.logging.log4j; + requires org.slf4j; + requires static org.jetbrains.annotations; + + exports net.neoforged.fml.lowcodemod; + + provides net.neoforged.neoforgespi.language.IModLanguageProvider with + net.neoforged.fml.lowcodemod.LowCodeModLanguageProvider; +} \ No newline at end of file diff --git a/languages/lowcode/src/main/resources/META-INF/services/net.neoforged.neoforgespi.language.IModLanguageProvider b/languages/lowcode/src/main/resources/META-INF/services/net.neoforged.neoforgespi.language.IModLanguageProvider deleted file mode 100644 index b1ea5908b..000000000 --- a/languages/lowcode/src/main/resources/META-INF/services/net.neoforged.neoforgespi.language.IModLanguageProvider +++ /dev/null @@ -1 +0,0 @@ -net.neoforged.fml.lowcodemod.LowCodeModLanguageProvider diff --git a/languages/minecraft/src/main/java/module-info.java b/languages/minecraft/src/main/java/module-info.java new file mode 100644 index 000000000..6500e5559 --- /dev/null +++ b/languages/minecraft/src/main/java/module-info.java @@ -0,0 +1,12 @@ +open module net.neoforged.fancymodloader.language.minecraft { + requires net.neoforged.bus; + requires net.neoforged.neoforgespi; + requires net.neoforged.fancymodloader.core; + requires org.apache.logging.log4j; + requires static org.jetbrains.annotations; + + exports net.neoforged.fml.mclanguageprovider; + + provides net.neoforged.neoforgespi.language.IModLanguageProvider with + net.neoforged.fml.mclanguageprovider.MinecraftModLanguageProvider; +} \ No newline at end of file diff --git a/languages/minecraft/src/main/resources/META-INF/services/net.neoforged.neoforgespi.language.IModLanguageProvider b/languages/minecraft/src/main/resources/META-INF/services/net.neoforged.neoforgespi.language.IModLanguageProvider deleted file mode 100644 index e3b88effe..000000000 --- a/languages/minecraft/src/main/resources/META-INF/services/net.neoforged.neoforgespi.language.IModLanguageProvider +++ /dev/null @@ -1 +0,0 @@ -net.neoforged.fml.mclanguageprovider.MinecraftModLanguageProvider diff --git a/loader/build.gradle b/loader/build.gradle index 8e2afc2df..4fb8c0bf0 100644 --- a/loader/build.gradle +++ b/loader/build.gradle @@ -4,6 +4,8 @@ dependencies { api("org.ow2.asm:asm:${asm_version}") api("org.ow2.asm:asm-tree:${asm_version}") api("org.ow2.asm:asm-commons:${asm_version}") + api("org.ow2.asm:asm-analysis:${asm_version}") + api("org.ow2.asm:asm-util:${asm_version}") api(project(':spi')) api("net.neoforged:mergetool:${mergetool_version}:api") api("org.apache.logging.log4j:log4j-api:${log4j_version}") diff --git a/loader/src/main/java/module-info.java b/loader/src/main/java/module-info.java new file mode 100644 index 000000000..a9778553a --- /dev/null +++ b/loader/src/main/java/module-info.java @@ -0,0 +1,71 @@ +open module net.neoforged.fancymodloader.loader { + requires net.neoforged.accesstransformer; + requires net.neoforged.accesstransformer.modlauncher; + requires com.electronwill.nightconfig.core; + requires com.google.common; + requires com.google.gson; + requires cpw.mods.modlauncher; + requires cpw.mods.securejarhandler; + requires JarJarSelector; + requires logging; + requires maven.artifact; + requires net.neoforged.neoforgespi; + requires net.neoforged.mergetool.api; + requires org.apache.commons.lang3; + requires org.apache.logging.log4j.core; + requires org.apache.logging.log4j; + requires org.objectweb.asm.commons; + requires org.objectweb.asm.tree; + requires org.objectweb.asm.tree.analysis; + requires org.objectweb.asm.util; + requires org.objectweb.asm; + requires org.slf4j; + requires org.spongepowered.mixin; + requires terminalconsoleappender; + requires static org.jetbrains.annotations; + + exports net.neoforged.fml.common.asm; + exports net.neoforged.fml.loading; + exports net.neoforged.fml.loading.log4j; + exports net.neoforged.fml.loading.moddiscovery; + exports net.neoforged.fml.loading.progress; + exports net.neoforged.fml.loading.targets; + exports net.neoforged.fml.loading.toposort; + exports net.neoforged.fml.server; + + uses net.neoforged.neoforgespi.coremod.ICoreModProvider; + uses net.neoforged.neoforgespi.language.IModLanguageProvider; + uses net.neoforged.neoforgespi.locating.IModLocator; + uses net.neoforged.neoforgespi.locating.IDependencyLocator; + uses net.neoforged.fml.loading.ImmediateWindowProvider; + + provides cpw.mods.modlauncher.api.ILaunchHandlerService with + net.neoforged.fml.loading.targets.ForgeClientLaunchHandler, + net.neoforged.fml.loading.targets.ForgeClientDevLaunchHandler, + net.neoforged.fml.loading.targets.ForgeClientUserdevLaunchHandler, + net.neoforged.fml.loading.targets.ForgeServerLaunchHandler, + net.neoforged.fml.loading.targets.ForgeServerDevLaunchHandler, + net.neoforged.fml.loading.targets.ForgeServerUserdevLaunchHandler, + net.neoforged.fml.loading.targets.ForgeDataDevLaunchHandler, + net.neoforged.fml.loading.targets.ForgeDataUserdevLaunchHandler; + provides cpw.mods.modlauncher.api.INameMappingService with + net.neoforged.fml.loading.MCPNamingService; + provides cpw.mods.modlauncher.api.ITransformationService with + net.neoforged.fml.loading.FMLServiceProvider; + provides cpw.mods.modlauncher.serviceapi.ILaunchPluginService with + net.neoforged.fml.loading.log4j.SLF4JFixerLaunchPluginService, + net.neoforged.fml.common.asm.RuntimeDistCleaner, + net.neoforged.fml.common.asm.RuntimeEnumExtender; + provides cpw.mods.modlauncher.serviceapi.ITransformerDiscoveryService with + net.neoforged.fml.loading.ModDirTransformerDiscoverer, + net.neoforged.fml.loading.ClasspathTransformerDiscoverer; + provides net.neoforged.neoforgespi.locating.IDependencyLocator with + net.neoforged.fml.loading.moddiscovery.JarInJarDependencyLocator; + provides net.neoforged.neoforgespi.locating.IModLocator with + net.neoforged.fml.loading.moddiscovery.ModsFolderLocator, + net.neoforged.fml.loading.moddiscovery.MavenDirectoryLocator, + net.neoforged.fml.loading.moddiscovery.ExplodedDirectoryLocator, + net.neoforged.fml.loading.moddiscovery.MinecraftLocator, + net.neoforged.fml.loading.moddiscovery.ClasspathLocator, + net.neoforged.fml.loading.moddiscovery.BuiltinGameLibraryLocator; +} \ No newline at end of file diff --git a/loader/src/main/java/net/neoforged/fml/loading/targets/CommonLaunchHandler.java b/loader/src/main/java/net/neoforged/fml/loading/targets/CommonLaunchHandler.java index ecdf54167..cfb1d7013 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/targets/CommonLaunchHandler.java +++ b/loader/src/main/java/net/neoforged/fml/loading/targets/CommonLaunchHandler.java @@ -58,7 +58,7 @@ public void configureTransformationClassLoader(final ITransformingClassLoaderBui protected String[] preLaunch(String[] arguments, ModuleLayer layer) { URI uri; - try (var reader = layer.configuration().findModule("fml_loader").orElseThrow().reference().open()) { + try (var reader = layer.configuration().findModule("net.neoforged.fancymodloader.loader").orElseThrow().reference().open()) { uri = reader.find("log4j2.xml").orElseThrow(); } catch (IOException e) { throw new RuntimeException(e); diff --git a/loader/src/main/java/net/neoforged/fml/loading/targets/FMLClientLaunchHandler.java b/loader/src/main/java/net/neoforged/fml/loading/targets/FMLClientLaunchHandler.java index 20cc4da21..5baeba26f 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/targets/FMLClientLaunchHandler.java +++ b/loader/src/main/java/net/neoforged/fml/loading/targets/FMLClientLaunchHandler.java @@ -17,7 +17,7 @@ public class FMLClientLaunchHandler extends CommonClientLaunchHandler { @Override protected void processMCStream(VersionInfo versionInfo, Stream.Builder mc, Stream.Builder> mods) { - var fmlonly = LibraryFinder.findPathForMaven("net.neoforged.fml", "fmlonly", "", "universal", versionInfo.mcAndFmlVersion()); + var fmlonly = LibraryFinder.findPathForMaven("net.neoforged.fancymodloader", "fmlonly", "", "universal", versionInfo.mcAndFmlVersion()); mods.add(List.of(fmlonly)); } } diff --git a/loader/src/main/java/net/neoforged/fml/loading/targets/FMLServerLaunchHandler.java b/loader/src/main/java/net/neoforged/fml/loading/targets/FMLServerLaunchHandler.java index 512b1de25..db5d87f5d 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/targets/FMLServerLaunchHandler.java +++ b/loader/src/main/java/net/neoforged/fml/loading/targets/FMLServerLaunchHandler.java @@ -17,7 +17,7 @@ public class FMLServerLaunchHandler extends CommonServerLaunchHandler { @Override protected void processMCStream(VersionInfo versionInfo, Stream.Builder mc, Stream.Builder> mods) { - var fmlonly = LibraryFinder.findPathForMaven("net.neoforged.fml", "fmlonly", "", "universal", versionInfo.mcAndFmlVersion()); + var fmlonly = LibraryFinder.findPathForMaven("net.neoforged.fancymodloader", "fmlonly", "", "universal", versionInfo.mcAndFmlVersion()); mods.add(List.of(fmlonly)); } } diff --git a/loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.api.ILaunchHandlerService b/loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.api.ILaunchHandlerService deleted file mode 100644 index a263947e3..000000000 --- a/loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.api.ILaunchHandlerService +++ /dev/null @@ -1,8 +0,0 @@ -net.neoforged.fml.loading.targets.ForgeClientLaunchHandler -net.neoforged.fml.loading.targets.ForgeClientDevLaunchHandler -net.neoforged.fml.loading.targets.ForgeClientUserdevLaunchHandler -net.neoforged.fml.loading.targets.ForgeServerLaunchHandler -net.neoforged.fml.loading.targets.ForgeServerDevLaunchHandler -net.neoforged.fml.loading.targets.ForgeServerUserdevLaunchHandler -net.neoforged.fml.loading.targets.ForgeDataDevLaunchHandler -net.neoforged.fml.loading.targets.ForgeDataUserdevLaunchHandler diff --git a/loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.api.INameMappingService b/loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.api.INameMappingService deleted file mode 100644 index 4994ff917..000000000 --- a/loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.api.INameMappingService +++ /dev/null @@ -1 +0,0 @@ -net.neoforged.fml.loading.MCPNamingService diff --git a/loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.api.ITransformationService b/loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.api.ITransformationService deleted file mode 100644 index 6c340660b..000000000 --- a/loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.api.ITransformationService +++ /dev/null @@ -1 +0,0 @@ -net.neoforged.fml.loading.FMLServiceProvider \ No newline at end of file diff --git a/loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.serviceapi.ILaunchPluginService b/loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.serviceapi.ILaunchPluginService deleted file mode 100644 index 580f7de7c..000000000 --- a/loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.serviceapi.ILaunchPluginService +++ /dev/null @@ -1,3 +0,0 @@ -net.neoforged.fml.loading.log4j.SLF4JFixerLaunchPluginService -net.neoforged.fml.common.asm.RuntimeDistCleaner -net.neoforged.fml.common.asm.RuntimeEnumExtender \ No newline at end of file diff --git a/loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.serviceapi.ITransformerDiscoveryService b/loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.serviceapi.ITransformerDiscoveryService deleted file mode 100644 index 48a1df0f8..000000000 --- a/loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.serviceapi.ITransformerDiscoveryService +++ /dev/null @@ -1,2 +0,0 @@ -net.neoforged.fml.loading.ModDirTransformerDiscoverer -net.neoforged.fml.loading.ClasspathTransformerDiscoverer \ No newline at end of file diff --git a/loader/src/main/resources/META-INF/services/net.neoforged.neoforgespi.locating.IDependencyLocator b/loader/src/main/resources/META-INF/services/net.neoforged.neoforgespi.locating.IDependencyLocator deleted file mode 100644 index 8dc3d96d6..000000000 --- a/loader/src/main/resources/META-INF/services/net.neoforged.neoforgespi.locating.IDependencyLocator +++ /dev/null @@ -1 +0,0 @@ -net.neoforged.fml.loading.moddiscovery.JarInJarDependencyLocator \ No newline at end of file diff --git a/loader/src/main/resources/META-INF/services/net.neoforged.neoforgespi.locating.IModLocator b/loader/src/main/resources/META-INF/services/net.neoforged.neoforgespi.locating.IModLocator deleted file mode 100644 index 920303df9..000000000 --- a/loader/src/main/resources/META-INF/services/net.neoforged.neoforgespi.locating.IModLocator +++ /dev/null @@ -1,6 +0,0 @@ -net.neoforged.fml.loading.moddiscovery.ModsFolderLocator -net.neoforged.fml.loading.moddiscovery.MavenDirectoryLocator -net.neoforged.fml.loading.moddiscovery.ExplodedDirectoryLocator -net.neoforged.fml.loading.moddiscovery.MinecraftLocator -net.neoforged.fml.loading.moddiscovery.ClasspathLocator -net.neoforged.fml.loading.moddiscovery.BuiltinGameLibraryLocator diff --git a/spi/src/main/java/module-info.java b/spi/src/main/java/module-info.java new file mode 100644 index 000000000..a9be66b42 --- /dev/null +++ b/spi/src/main/java/module-info.java @@ -0,0 +1,13 @@ +open module net.neoforged.neoforgespi { + requires maven.artifact; + requires net.neoforged.mergetool.api; + requires org.apache.logging.log4j; + requires org.objectweb.asm; + requires cpw.mods.securejarhandler; + requires cpw.mods.modlauncher; + + exports net.neoforged.neoforgespi; + exports net.neoforged.neoforgespi.coremod; + exports net.neoforged.neoforgespi.language; + exports net.neoforged.neoforgespi.locating; +} \ No newline at end of file