Class VersionChecker

java.lang.Object
net.neoforged.neoforge.common.VersionChecker

public class VersionChecker extends Object

The version checker system, usable by mods. A mod can opt into using this system by specifying the update URL in their mod metadata, which leads to a JSON file.

The JSON file contains a JSON object with the following format (where keys are optional unless otherwise indicated):

  • homepage: a string, containing a URL which is displayed on the changelog screen.
  • promos: a required JSON object, of the promoted versions per Minecraft version
    • <mc-version>-recommended - the recommended mod version for the given Minecraft version
    • <mc-version>-latest - the latest mod version for the given Minecraft version
  • <mc-version>: a JSON object, of mappings from mod versions to changelog entries
    • <mod-version>: a string, containing a changelog entry for that mod version

The following is an example JSON file:

{
    "homepage": "https://homepage.example",
    "promos": {
      "26.3-latest": "2.0.1",
      "26.2-latest": "1.2.0",
      "26.2-recommended": "1.1.4"
    },
    "26.3": {
      "2.0.1": "Fixed a bug causing skeletons to shoot explosive arrows",
      "2.0.0": "New release for MC 26.3"
    },
    "26.2": {
      "1.2.0": "Rewrote the main handling code",
      "1.1.4": "Fixed a bug causing creepers to disappear rather than explode",
      "1.1.3": "Fixed the language entry for zombies",
      "1.1.2": "Cleaned up the mod metadata a bit",
      "1.1.1": "Fixed an issue with sounds playing when they shouldn't be",
      "1.1.0": "Added language entries for most overworld enemies",
      "1.0.0": "Initial release for MC 26.2"
    }
}
See Also:
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • HTTP_TIMEOUT_SECS

      private static final int HTTP_TIMEOUT_SECS
    • RESULTS

      private static final Map<IModInfo, VersionChecker.CheckResult> RESULTS
  • Constructor Details

    • VersionChecker

      public VersionChecker()
  • Method Details

    • isEnabled

      public static boolean isEnabled()
      Returns whether the version check system is enabled.. This is controlled by the FML config value FMLConfig.ConfigValue.VERSION_CHECK.
      Returns:
      whether the version check system is enabled
    • getResult

      public static @Nullable VersionChecker.CheckResult getResult(IModInfo mod)
      Returns the version check result for the given mod, or null if there is none. This will return null both for mods which do not use the version check system, and for mods which do use it but are currently being checked.
      Returns:
      the version check result for the given mod, or null if there is none
    • startVersionCheck

      @Internal public static void startVersionCheck()