Skip to main content

elemental_schema/fabric/
meta.rs

1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4
5use crate::mojang::piston::PistonMetaArguments;
6
7#[derive(Debug, Clone, Deserialize, Serialize)]
8pub struct LoaderVersion {
9    pub separator: String,
10    pub build: i32,
11    pub maven: String,
12    pub version: String,
13    pub stable: bool,
14}
15
16#[derive(Debug, Clone, Deserialize, Serialize)]
17pub struct GameVersion {
18    pub version: String,
19    pub stable: bool,
20}
21
22#[derive(Debug, Clone, Deserialize, Serialize)]
23pub struct IntermediaryVersion {
24    pub maven: String,
25    pub version: String,
26    pub stable: bool,
27}
28
29#[derive(Debug, Clone, Deserialize, Serialize)]
30pub struct LoaderGameVersion {
31    pub loader: LoaderVersion,
32    pub intermediary: IntermediaryVersion,
33}
34
35#[derive(Debug, Clone, Deserialize, Serialize)]
36pub struct LauncherLibrary {
37    pub name: String,
38    pub url: String,
39}
40
41#[derive(Debug, Clone, Deserialize, Serialize)]
42pub struct LauncherLibraries {
43    pub client: Vec<LauncherLibrary>,
44    pub common: Vec<LauncherLibrary>,
45    pub server: Vec<LauncherLibrary>,
46}
47
48#[derive(Debug, Clone, Deserialize, Serialize)]
49pub struct LauncherMainClass {
50    pub client: String,
51    pub server: String,
52}
53
54#[derive(Debug, Clone, Deserialize, Serialize)]
55pub struct LauncherMeta {
56    pub version: usize,
57    pub libraries: LauncherLibraries,
58    #[serde(rename = "mainClass")]
59    pub main_class: LauncherMainClass,
60}
61
62#[derive(Debug, Clone, Deserialize, Serialize)]
63pub struct LoaderProfile {
64    pub loader: LoaderVersion,
65    pub intermediary: IntermediaryVersion,
66    #[serde(rename = "launcherMeta")]
67    pub launcher_meta: LauncherMeta,
68}
69
70#[derive(Debug, Clone, Deserialize, Serialize)]
71pub struct ProfileLibrary {
72    pub name: String,
73    #[serde(default)]
74    pub url: String,
75    pub downloads: Option<ProfileLibraryDownloads>,
76    pub natives: Option<HashMap<String, String>>,
77    pub extract: Option<ProfileLibraryExtract>,
78}
79
80#[derive(Debug, Clone, Deserialize, Serialize)]
81pub struct ProfileLibraryDownloads {
82    pub artifact: Option<ProfileLibraryArtifact>,
83    pub classifiers: Option<HashMap<String, ProfileLibraryArtifact>>,
84}
85
86#[derive(Debug, Clone, Deserialize, Serialize)]
87pub struct ProfileLibraryArtifact {
88    pub path: String,
89    pub url: String,
90    pub size: Option<usize>,
91    pub sha1: Option<String>,
92}
93
94#[derive(Debug, Clone, Deserialize, Serialize)]
95pub struct ProfileLibraryExtract {
96    pub exclude: Vec<String>,
97}
98
99#[derive(Debug, Clone, Deserialize, Serialize)]
100pub struct ProfileLoggingFile {
101    pub id: String,
102    pub sha1: String,
103    pub size: usize,
104    pub url: String,
105}
106
107#[derive(Debug, Clone, Deserialize, Serialize)]
108pub struct ProfileLoggingClient {
109    pub argument: String,
110    pub file: ProfileLoggingFile,
111    #[serde(rename = "type")]
112    pub logging_type: String,
113}
114
115#[derive(Debug, Clone, Deserialize, Serialize)]
116pub struct ProfileLogging {
117    pub client: ProfileLoggingClient,
118}
119
120#[derive(Debug, Clone, Deserialize, Serialize)]
121pub struct ProfileJson {
122    pub id: String,
123    #[serde(rename = "inheritsFrom")]
124    pub inherits_from: String,
125    pub arguments: Option<PistonMetaArguments>,
126    pub assets: Option<String>,
127    pub libraries: Vec<ProfileLibrary>,
128    pub logging: Option<ProfileLogging>,
129    #[serde(rename = "mainClass")]
130    pub main_class: String,
131    #[serde(rename = "minimumLauncherVersion")]
132    pub minimum_launcher_version: Option<usize>,
133    #[serde(rename = "type")]
134    pub release_type: String,
135    pub time: String,
136    #[serde(rename = "releaseTime")]
137    pub release_time: String,
138}