Views
Actions
Difference between revisions of "Version Checker"
m (SciWhiz12 moved page Using the Forge Update Checker to Version Checker without leaving a redirect: Shorten page title, as the old one was too large and unnecessary) |
(rewrite the page, adding more information) |
||
Line 1: | Line 1: | ||
− | + | The '''Update 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 update 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 update 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. | |
− | |||
− | The | ||
== Update JSON format == | == Update JSON format == | ||
+ | The update 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>]]. 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 update checker statuses, according to the <code>VersionChecker.Status</code> enum: | |
− | < | + | * <code>PENDING</code> - The update 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 update 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 update 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. |
Revision as of 11:58, 7 January 2021
The Update 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 update 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 Update available:
line with the homepage
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.
The update checker can be configured through the versionCheck
option in the FML config (config/fml.toml). This option controls the version checking for all mods, including Forge.
Update JSON format
The update checker checks the update JSON, specified by the updateJSONURL
for the mod in the mods.toml. An example of a JSON file is the update JSON for Minecraft Forge. The JSON file must be in the following format:
- Root object
homepage
(string): A URL, displayed on the mod's information screen on the Mods list screenpromos
(object)<minecraft version>-latest
(string): A version string, for the latest mod version corresponding to the given Minecraft version<minecraft version>-recommended
(string): A version string, for the recommended mod version corresponding to the given Minecraft version- ...
<minecraft version>
(object)<mod version>
(string): Any text, displayed when the the specified mod version in the key is ahead of currently installed version; used as a changelog- ...
Update status
There are 7 possible update checker statuses, according to the VersionChecker.Status
enum:
PENDING
- The update 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.FAILED
- The update checker failed, either to retrieve the update JSON or some other error (such as failure to parse broken JSON).UP_TO_CODE
- The currently installed version is the same as the recommended version for the current Minecraft version.OUTDATED
- 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.AHEAD
- 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.BETA
- 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.BETA_OUTDATED
- There is no recommended version, and the currently installed version is behind the latest version for the MC version.
CheckResult
The update checker result for a mod can be retrieving using the VersionChecker.getResult(IModInfo)
static method which returns a CheckResult
. (IModInfo
is the information for a specific mod; see ModList#getModContainerById(String)
and ModContainer#getModInfo()
).
The CheckResult
contains four unmodifiable fields:
status
, the version checker status as aVersionChecker.Status
enum value.target
, the version which caused theOUTDATED
,BETA
orBETA_OUTDATED
- If the status is
OUTDATED
, this is the newest recommended or latest version from the JSON. - If the status is
BETA_OUTDATED
orBETA
, this is the highest newest version from the JSON. - This may be
null
if the status isBETA
, and there is no recommended or latest version defined in the JSON file.
- If the status is
changes
, 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.url
, the URL from thehomepage
string in the update JSON, displayed on the mods information screen.