Class VersionChecker
java.lang.Object
net.neoforged.neoforge.common.VersionChecker
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe version check result for a given mod.static enumThe status of a version check result.private static final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final org.slf4j.Loggerprivate static final Map<IModInfo, VersionChecker.CheckResult> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the version check result for the given mod, ornullif there is none.static booleanReturns whether the version check system is enabled.static void
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
HTTP_TIMEOUT_SECS
private static final int HTTP_TIMEOUT_SECS -
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 valueFMLConfig.ConfigValue.VERSION_CHECK.- Returns:
- whether the version check system is enabled
-
getResult
Returns the version check result for the given mod, ornullif there is none. This will returnnullboth 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
nullif there is none
-
startVersionCheck
-