mc_launchermeta/lib.rs
1////////////////////////////////////////////////////////////////////////////////
2// Copyright (c) 2023. Rob Bailey /
3// This Source Code Form is subject to the terms of the Mozilla Public /
4// License, v. 2.0. If a copy of the MPL was not distributed with this /
5// file, You can obtain one at https://mozilla.org/MPL/2.0/. /
6////////////////////////////////////////////////////////////////////////////////
7
8//! A simple crate that defines the types used by the Minecraft version manifest.
9//!
10//! This crate deliberately does not include any code to actually fetch from the endpoints, as to
11//! not tie it to any particular HTTP client.
12//!
13//! ## Usage
14//!
15//! Basic usage of this crate would involve fetching the version manifest from the URL defined in
16//! VERSION_MANIFEST_URL, and then fetching the version JSON file from the URL defined in the
17//! Version.url field for the corresponding version.
18//!
19//! No examples are provided, as the exact usage will depend on the HTTP client used to fetch the
20//! manifest and the version JSON files.
21//!
22//! ## Disclaimer
23//!
24//! This project is not affiliated with Minecraft, Mojang or Microsoft.
25//!
26//! All product and company names are trademarks™ or registered® trademarks of their respective
27//! holders. Use of them does not imply any affiliation with or endorsement by them.
28
29use serde::{Deserialize, Serialize};
30
31pub mod asset_index;
32pub mod version;
33pub mod version_manifest;
34
35/// The current URL to get the version manifest from.
36pub const VERSION_MANIFEST_URL: &str =
37 "https://launchermeta.mojang.com/mc/game/version_manifest.json";
38
39/// Type of Minecraft versions
40#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Serialize, Deserialize)]
41#[serde(rename_all = "snake_case")]
42pub enum VersionKind {
43 Release,
44 Snapshot,
45 OldBeta,
46 OldAlpha,
47 OldSnapshot,
48 Experiment,
49}