pub struct Root {
pub arguments: Arguments,
pub asset_index: AssetIndex,
pub assets: String,
pub downloads: HashMap<String, DownloadData>,
pub id: String,
pub java_version: JavaVersion,
pub libraries: Box<[Library]>,
pub inherits_from: Option<String>,
pub main_class: String,
pub version_type: String,
}Expand description
This struct represent a .json file inside minecraft_root/versions/{version_name}/{version_name}.json
Careful: inherits_from indicates that it should inherit the values
from other version. (The values must be added and not overwrite the
current data)
This struct is also the repr of minecraft version from piston-meta.
This struct will be used when launching minecraft from the command line and/or when downloading a new minecraft profile from piston-meta.
§JSON EXAMPLE
An example of the outter JSON might looks like this:
{
arguments: {…},
assetIndex: {…},
assets: "19",
complianceLevel: 1,
downloads: {…},
id: "1.21.4",
javaVersion: {…},
libraries: […],
logging: {…},
mainClass: "net.minecraft.client.main.Main",
minimumLauncherVersion: 21,
type: "release"
}The fields are renamed to snake_case and type -> version_type since type
is a keyword.
§Downloading minecraft yay !
When using this struct to download a new minecraft version fields of insterest are:
asset_indexassetslibrariesdownloadsjava_version(In case Java is not installed)
You will find urls to file/files you need in order to run minecraft.
§Launching minecraft !
So in order to launch minecraft you will need to read a file from minecraft_root/versions/{version_name}/{version_name}.json
This file contains a JSON with this struct. You will need the following fields in order to launch minecraft:
- arguments
- assets
- java_version (In case Java is not installed or you want the custom runtime)
- libraries (you must add them to java path -cp)
- main_class
- logging (Not mandatory but usefull)
I KNOW TIME AND RELEASETIME FIELDS ARE MISSING, NEED THEM ? PR !!!!
Fields§
§arguments: Arguments§asset_index: AssetIndex§assets: String§downloads: HashMap<String, DownloadData>.minecraft/versions/version/version.jar
id: StringActual version example: 1.21.7
java_version: JavaVersion§libraries: Box<[Library]>§inherits_from: Option<String>§main_class: String§version_type: StringImplementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Root
impl RefUnwindSafe for Root
impl Send for Root
impl Sync for Root
impl Unpin for Root
impl UnwindSafe for Root
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more