Skip to content

Conversation

@shartte
Copy link
Contributor

@shartte shartte commented Oct 21, 2025

The goal of this PR is to include machine readable version information from our gradle build in the built NeoForge jar. Intent is to remove all command line options from FML for specifying versions since they can all be derived from the NeoForge jar file once this PR adds the necessary information to the jar. (Specifically based on the NeoForge version in use, which Minecraft version is required, and which NeoForm version)

Since it is related to versioning, this also resolves:

  • Removing "ForgeSnapshot" classes, inlining the functionality where appropriate
  • Detection of what a PR build is based on the version number inside of NeoForge. This is now handled by the new "build_type" enum
  • Detection of what a non-stable/beta release is, this is also now handled by Gradle and passed as the build_type into NeoForge
  • Fixes display of the beta & PR build warnings on the main menu (alpha was wrong)

We may also want to include the commit hash / branch / potential build times in the version properties.

A generated net/neoforged/neoforge/common/version.properties looks like this:

neoforge_version=21.10.28-beta-feature-version-info
neoform_version=1.21.10-20251007.142004
minecraft_version=1.21.10
build_type=BETA

A generated net/neoforged/neoforge/common/NeoForgeVersion.java looks like this:

/*
 * Copyright (c) NeoForged and contributors
 * SPDX-License-Identifier: LGPL-2.1-only
 */

package net.neoforged.neoforge.common;

@ApiStatus.Internal
public final class NeoForgeVersion {
    private NeoForgeVersion() {}

    private static final NeoForgeBuildType BUILD_TYPE = NeoForgeBuildType.valueOf("BETA");

    public static String getVersion() {
        return "21.10.38-beta-feature-version-info";
    }

    public static NeoForgeBuildType getBuildType() {
        return BUILD_TYPE;
    }
}

@neoforged-automation neoforged-automation bot added the 1.21.10 Targeted at Minecraft 1.21.10 label Oct 21, 2025
@neoforged-pr-publishing
Copy link

  • Publish PR to GitHub Packages

@shartte shartte force-pushed the feature/version-info branch from 0c37f20 to 5e200ba Compare October 22, 2025 20:06
@neoforged-compatibility-checks
Copy link

neoforged-compatibility-checks bot commented Oct 22, 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: 92fc3afcaae4c1658d92ceb529165badcf42c780.

neoforge (:neoforge)

  • net/neoforged/neoforge/forge/snapshots/ForgeSnapshotsMod
    • ❗ API class no longer exists
  • net/neoforged/neoforge/internal/versions/neoforge/NeoForgeVersion
    • ❗ API class no longer exists
  • net/neoforged/neoforge/client/internal/ForgeSnapshotsModClient
    • ⚠ API class no longer exists
  • net/neoforged/neoforge/common/NeoForgeMod
    • isPRBuild()Z: ❗ API method was removed

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.

A few minor comments

@Technici4n
Copy link
Member

Another thing... Is the NeoForge version not already in the neoforge.mods.toml? Why are we duplicating it here?

@shartte
Copy link
Contributor Author

shartte commented Oct 24, 2025

Another thing... Is the NeoForge version not already in the neoforge.mods.toml? Why are we duplicating it here?

Because that requires a TOML parser and you also need the Minecraft/NeoForm version

@Technici4n
Copy link
Member

Because that requires a TOML parser and you also need the Minecraft/NeoForm version

Which FML does have access to? Maybe we only need the MC and NeoForm versions in the properties file, and the NeoForge version can be read from the TOML. I think that the information duplication, even if it's small, is a bit suspicious. :P

@shartte
Copy link
Contributor Author

shartte commented Oct 24, 2025

Because that requires a TOML parser and you also need the Minecraft/NeoForm version

Which FML does have access to? Maybe we only need the MC and NeoForm versions in the properties file, and the NeoForge version can be read from the TOML. I think that the information duplication, even if it's small, is a bit suspicious. :P

No, I don't like this. I need this during the startup phase in FML, and I really don't wanna start parsing mod toml files to get the NeoForge version AND have to load a properties file to get the MC/NeoForm versions as well. There's zero maintenance burden to expose the NF version this way.

p.s.: What I can see is making the NeoForm version internal since that's a bit of an implementation detail, while the NeoForge/Minecraft versions are quite publicly facing.

p.p.s.: another reason I'd not want to rely on neoforge.mods.toml is that it is not unique, while we can rely on net/neoforged/neoforge/common/version.properties being unique on the class-path. When FML starts and looks for this on the CP, it'll be a lot less of a problem.

# Conflicts:
#	src/client/java/net/neoforged/neoforge/client/ClientHooks.java
@shartte shartte requested a review from Technici4n October 24, 2025 22:38
@shartte shartte merged commit 7d5c75a into 1.21.x Oct 25, 2025
8 checks passed
@shartte shartte deleted the feature/version-info branch October 25, 2025 09:54
@neoforged-releases
Copy link

🚀 This PR has been released as NeoForge version 21.10.34-beta.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.21.10 Targeted at Minecraft 1.21.10

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants