The '''Version Checker''' is a Forge-provided utility for mods to check for new versions based on an online update JSON file. It is lightweight, toggleable, asynchoronous to the main mod loading, and integrates cleanly with the mods list menu.
If there are outdated mods according to the version checker, a flashing emerald indicator will be shown on the Mods button on the main menu. The entries for the outdated mods in the mods list screen have the flashing emerald indicator. The information screen for outdated mods will have an <code>Update available:</code> line with the <code>homepage</code> URL from the update JSON file, and a list of mod versions and corresponding text after the mod description, for the mod versions between the most up-to-date and the currently installed version.
<!-- TODO: add images of these -->
The version checker can be configured through the <code>versionCheck</code> option in the FML config (<tt>config/fml.toml</tt>). This option controls the version checking for all mods, including Forge.
== Update JSON format ==
The version checker checks the update JSON, specified by the <code>updateJSONURL</code> for the [[Proper Mod Structuring#Mod Properties|mod in the <tt>mods.toml</tt>/1.16]]. An example of a JSON file is the [https://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json update JSON for Minecraft Forge]. The JSON file must be in the following format:
{{Tree list}}
* '''Root object'''
** <code>homepage</code> (string): A URL, displayed on the mod's information screen on the Mods list screen
** <code>promos</code> (object)
*** <code>'''''<nowiki><minecraft version></nowiki>'''''-latest</code> (string): A version string, for the latest mod version corresponding to the given Minecraft version
*** <code>'''''<nowiki><minecraft version></nowiki>'''''-recommended</code> (string): A version string, for the recommended mod version corresponding to the given Minecraft version
*** ...
** <code>'''''<nowiki><minecraft version></nowiki>'''''</code> (object)
*** <code>'''''<nowiki><mod version></nowiki>'''''</code> (string): Any text, displayed when the the specified mod version in the key is ahead of currently installed version; used as a changelog
*** ...
{{Tree list/end}}
== Update status ==
There are 7 possible version checker statuses, according to the <code>VersionChecker.Status</code> enum:
* <code>PENDING</code> - The version checker has not or is currently retrieving the version from the update JSON. This is temporary, and will change into one of the other statuses.
* <code>FAILED</code> - The version checker failed, either to retrieve the update JSON or some other error (such as failure to parse broken JSON).
* <code>UP_TO_CODE</code> - The currently installed version is the same as the recommended version for the current Minecraft version.
* <code>OUTDATED</code> - The currently installed version is either behind the recommended version for the MC version, or ahead of the recommended version, but behind the latest version for the MC version.
* <code>AHEAD</code> - The currently installed version is ahead of the recommended version for the MC version, and there is no more up-to-date latest version for the MC version. <!-- might reword the second part -->
* <code>BETA</code> - There is no recommended version, and either the currently installed version is up-to-date or ahead of the latest version, or there is no latest version for the MC version.
* <code>BETA_OUTDATED</code> - There is no recommended version, and the currently installed version is behind the latest version for the MC version.
== <tt>CheckResult</tt> ==
The version checker result for a mod can be retrieving using the <code>VersionChecker.getResult(IModInfo)</code> static method which returns a <code>CheckResult</code>. (<code>IModInfo</code> is the information for a specific mod; see <code>ModList#getModContainerById(String)</code> and <code>ModContainer#getModInfo()</code>).
The <code>CheckResult</code> contains four unmodifiable fields:
* <code>status</code>, the version checker status as a <code>VersionChecker.Status</code> enum value.
* <code>target</code>, the version which caused the <code>OUTDATED</code>, <code>BETA</code> or <code>BETA_OUTDATED</code>
** If the status is <code>OUTDATED</code>, this is the newest recommended or latest version from the JSON.
** If the status is <code>BETA_OUTDATED</code> or <code>BETA</code>, this is the highest newest version from the JSON.
** This may be <code>null</code> if the status is <code>BETA</code>, and there is no recommended or latest version defined in the JSON file.
* <code>changes</code>, an unmodifiable map of mod versions and their corresponding text based on the MC version, where the mod versions are higher than the currently installed version. This information is shown on the mods information screen, as a changelog.
* <code>url</code>, the URL from the <code>homepage</code> string in the update JSON, displayed on the mods information screen.