Skip to content

Add support to create a pached Minecraft Jar on Startup#383

Open
shartte wants to merge 31 commits intomainfrom
feature/autoinstall
Open

Add support to create a pached Minecraft Jar on Startup#383
shartte wants to merge 31 commits intomainfrom
feature/autoinstall

Conversation

@shartte
Copy link
Contributor

@shartte shartte commented Oct 26, 2025

This PR will add support for automatically installing / producing the Minecraft jar if it is missing, assuming the installer is available in the libraries folder. This only applies to production and intends to replace https://github.com/PrismLauncher/ForgeWrapper for launchers.

The first phase of changes removes the locator for Minecraft/NeoForge and instead makes detecting "the game" an explicit first step, before FMLLoader is constructed. For this, most of the previous game locator code is moved into net.neoforged.fml.loading.game.GameDiscovery. In the same vein, VersionInfo is removed, since no CLI args except fml.neoForgeVersion are now required to launch. (no fml.mcVersion/fml.neoFormVersion) This information is now part of the NeoForge version properties file that is baked into NF.

As previously, if an unobfuscated MC is detected on the classpath, FML assumes it is launching in development mode, and skips the production logic. This PR will change nothing about how development detection works. For production, two modes are supported: NF can be on the startup classpath, in which case not even the fml.neoForgeVersion argument is required, or it can be loaded from the libraries folder.

Assuming FML is launching production, and NF was found. FML then only has to check if the single patched Minecraft Jar exists within the libraries folder, using the detected NeoForge version. The artifact paths are: net/neoforged/minecraft-client-patched/<neoForgeVersion>/minecraft-client-patched-<neoForgeVersion>.jar (and server, respectively).

If it exists, launch just continues as before. If it does not exist, and a system property for auto-installation is set, FML will proceed with the auto-installation.

The pre-requisite PRs for this were:

@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented Oct 26, 2025

  • Publish PR to GitHub Packages

Last commit published: e7928868d85f4c81d0a3ce3625d263fd751474db - version: 11.0.31-pr--

PR Publishing

The artifacts published by this PR:

Repository Declaration

In order to use the artifacts published by the PR, add the following repository to your buildscript:

repositories {
    maven {
        name = "Maven for PR #383" // https://github.com/neoforged/FancyModLoader/pull/383
        url = uri("https://prmaven.neoforged.net/FancyModLoader/pr383")
        content {
            includeModule("net.neoforged.fancymodloader", "earlydisplay")
            includeModule("net.neoforged.fancymodloader", "junit-fml")
            includeModule("net.neoforged.fancymodloader", "loader")
        }
    }
}

@neoforged-compatibility-checks
Copy link

neoforged-compatibility-checks bot commented Oct 26, 2025

@shartte, this PR introduces breaking changes.
Fortunately, this project is currently accepting breaking changes, but if they are not intentional, please revert them.
Last checked commit: e7928868d85f4c81d0a3ce3625d263fd751474db.

Compatibility checks

loader (:loader)

  • net/neoforged/fml/loading/FMLLoader$LaunchContextAdapter
    • getVersions()Lnet/neoforged/fml/loading/VersionInfo;: ❗ API method was removed
    • loadServices(Ljava/lang/Class;)Ljava/util/stream/Stream;: ❗ API method was removed
  • net/neoforged/neoforgespi/ILaunchContext
    • getMinecraftVersion()Ljava/lang/String;: ❗ Method was made abstract
    • getVersions()Lnet/neoforged/fml/loading/VersionInfo;: ❗ API method was removed
    • getNeoForgeVersion()Ljava/lang/String;: ❗ Method was made abstract
    • loadServices(Ljava/lang/Class;)Ljava/util/stream/Stream;: ❗ API method was removed
    • LOGGER:Lorg/slf4j/Logger;: ❗ API field was removed
  • net/neoforged/fml/loading/LibraryFinder
    • ❗ API class no longer exists
  • net/neoforged/fml/loading/FMLLoader
    • getVersionInfo()Lnet/neoforged/fml/loading/VersionInfo;: ❗ API method was removed
  • net/neoforged/fml/util/ServiceLoaderUtil
    • loadEarlyServices(Lnet/neoforged/neoforgespi/ILaunchContext;Ljava/lang/Class;Ljava/util/Collection;)Ljava/util/List;: ⚠ API method was removed
    • loadServices(Lnet/neoforged/neoforgespi/ILaunchContext;Ljava/lang/Class;Ljava/util/Collection;)Ljava/util/List;: ⚠ API method was removed
    • loadServices(Lnet/neoforged/neoforgespi/ILaunchContext;Ljava/lang/Class;Ljava/util/function/Predicate;)Ljava/util/List;: ⚠ API method was removed
    • loadServices(Lnet/neoforged/neoforgespi/ILaunchContext;Ljava/lang/Class;Ljava/util/Collection;Ljava/util/function/Predicate;)Ljava/util/List;: ⚠ API method was removed
    • loadServices(Lnet/neoforged/neoforgespi/ILaunchContext;Ljava/lang/Class;)Ljava/util/List;: ⚠ API method was removed
  • net/neoforged/fml/loading/moddiscovery/locators/GameLocator
    • ❗ API class no longer exists
  • net/neoforged/fml/loading/ImmediateWindowHandler
    • load(Lnet/neoforged/neoforgespi/ILaunchContext;ZLnet/neoforged/fml/loading/ProgramArgs;)V: ⚠ API method was removed
  • net/neoforged/fml/loading/VersionInfo
    • ❗ API class no longer exists
  • net/neoforged/fml/loading/VersionSupportMatrix
    • <init>(Lnet/neoforged/fml/loading/VersionInfo;)V: ❗ API method was removed
  • net/neoforged/fml/loading/moddiscovery/ModDiscoverer
    • <init>(Lnet/neoforged/neoforgespi/ILaunchContext;)V: ❗ API method was removed
    • <init>(Lnet/neoforged/neoforgespi/ILaunchContext;Ljava/util/Collection;)V: ❗ API method was removed

@neoforged-automation
Copy link

@shartte, this pull request has conflicts, please resolve them for this PR to move forward.

@neoforged-automation neoforged-automation bot added the needs rebase This Pull Request needs to be rebased before being merged label Nov 7, 2025
@shartte shartte force-pushed the feature/autoinstall branch from 4af4974 to d1f0f98 Compare November 27, 2025 16:16
@neoforged-automation neoforged-automation bot removed the needs rebase This Pull Request needs to be rebased before being merged label Nov 27, 2025
…when logged to the console or log files by logging a cause.
@marchermans marchermans marked this pull request as ready for review December 2, 2025 17:50
Copy link
Member

@Technici4n Technici4n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments are potentially inaccurate, to be double-checked later.

public ModDiscoverer(ILaunchContext launchContext) {
this(launchContext, List.of());
}
private final GameDiscoveryResult gameDiscoveryResult;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically we don't need to store it?

@neoforged-automation neoforged-automation bot added the needs rebase This Pull Request needs to be rebased before being merged label Dec 18, 2025
@neoforged-automation
Copy link

@shartte, this pull request has conflicts, please resolve them for this PR to move forward.

# Conflicts:
#	loader/src/main/java/net/neoforged/fml/loading/game/GameDiscovery.java
@neoforged-automation neoforged-automation bot removed the needs rebase This Pull Request needs to be rebased before being merged label Jan 2, 2026
@marchermans marchermans requested a review from Technici4n January 4, 2026 14:52
api "net.neoforged:JarJarSelector:${jarjar_version}"
api "net.neoforged:JarJarMetadata:${jarjar_version}"
api("net.neoforged:bus:${eventbus_version}")
api("net.neoforged.installertools:binarypatch-applier:${installer_tools_version}")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implementation?

@shartte shartte changed the title Auto Installation Support Add support to create a pached Minecraft Jar on-the-fly Jan 11, 2026
@shartte shartte changed the title Add support to create a pached Minecraft Jar on-the-fly Add support to create a pached Minecraft Jar on startup Jan 11, 2026
@shartte shartte changed the title Add support to create a pached Minecraft Jar on startup Add support to create a pached Minecraft Jar on Startup Jan 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants