Host all loaders for forge, fix stable markers, add java version to daedalus

This commit is contained in:
Jai A
2021-12-18 22:55:03 -07:00
parent d7e0468776
commit 5a6c06c8a3
9 changed files with 180 additions and 106 deletions

View File

@@ -229,6 +229,15 @@ pub struct LibraryExtract {
pub exclude: Option<Vec<String>>,
}
#[derive(Serialize, Deserialize, Debug)]
/// Information about the java version the game needs
pub struct JavaVersion {
/// The component needed for the Java installation
component: String,
/// The major Java version number
major_version: u32,
}
#[derive(Serialize, Deserialize, Debug)]
/// A library which the game relies on to run
pub struct Library {
@@ -311,6 +320,9 @@ pub struct VersionInfo {
pub downloads: HashMap<DownloadType, Download>,
/// The version ID of the version
pub id: String,
/// The Java version this version supports
pub java_version: JavaVersion,
/// Libraries that the version depends on
pub libraries: Vec<Library>,
/// The classpath to the main class to launch the game

View File

@@ -112,6 +112,7 @@ pub fn merge_partial_version(partial: PartialVersionInfo, merge: VersionInfo) ->
assets: merge.assets,
downloads: merge.downloads,
id: partial.id,
java_version: merge.java_version,
libraries: partial
.libraries
.into_iter()
@@ -140,24 +141,13 @@ pub struct Manifest {
pub game_versions: Vec<Version>,
}
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Hash, Clone)]
#[serde(rename_all = "camelCase")]
/// The version type of the loader
pub enum LoaderType {
/// The latest type is for experimental loader versions that may not be ready for normal use
Latest,
/// The stable type is for the most stable but recent loader version. For the forge mod loader,
/// this is never used
Stable,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
/// A game version of Minecraft
pub struct Version {
/// The minecraft version ID
pub id: String,
/// A map that contains loader versions for the game version
pub loaders: HashMap<LoaderType, LoaderVersion>,
pub loaders: Vec<LoaderVersion>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
@@ -167,6 +157,8 @@ pub struct LoaderVersion {
pub id: String,
/// The URL of the version's manifest
pub url: String,
/// Whether the loader is stable or not
pub stable: bool,
}
/// Fetches the manifest of a mod loader