Struct ClientBootstrap

Source
pub struct ClientBootstrap {
    pub settings: ClientSettings,
}

Fields§

§settings: ClientSettings

Implementations§

Source§

impl ClientBootstrap

Source

pub fn new(settings: ClientSettings) -> Self

Examples found in repository?
examples/launch_from_dot_minecraft.rs (lines 10-35)
9fn main() {
10    let bootstrap = ClientBootstrap::new(ClientSettings {
11        assets: get_mc_dir().join("assets"),
12        auth: ClientAuth {
13            username: "Sammwy_".to_string(),
14            access_token: None,
15            uuid: None,
16        },
17        game_dir: get_mc_dir(),
18        java_bin: PathBuf::from(
19            "C:\\Program Files\\Eclipse Adoptium\\jdk-17.0.7.7-hotspot\\bin\\java.exe",
20        ),
21        libraries_dir: get_mc_dir().join("libraries"),
22        manifest_file: get_mc_dir()
23            .join("versions")
24            .join("1.19.4")
25            .join("1.19.4.json"),
26        natives_dir: get_mc_dir().join("versions").join("1.19.4").join("natives"),
27        version: ClientVersion {
28            version: "1.19.4".to_string(),
29            version_type: "release".to_string(),
30        },
31        version_jar_file: get_mc_dir()
32            .join("versions")
33            .join("1.19.4")
34            .join("1.19.4.jar"),
35    });
36
37    bootstrap.launch().unwrap();
38}
Source

pub fn get_assets_dir(&self) -> PathBuf

Source

pub fn get_game_dir(&self) -> PathBuf

Source

pub fn get_json_file(&self) -> PathBuf

Source

pub fn get_jar_file(&self) -> PathBuf

Source

pub fn get_libs_dir(&self) -> PathBuf

Source

pub fn get_natives_dir(&self) -> PathBuf

Source

pub fn build_args(&self) -> Result<Vec<String>, ClientBootstrapError>

Source

pub fn launch(&self) -> Result<i32, ClientBootstrapError>

Examples found in repository?
examples/launch_from_dot_minecraft.rs (line 37)
9fn main() {
10    let bootstrap = ClientBootstrap::new(ClientSettings {
11        assets: get_mc_dir().join("assets"),
12        auth: ClientAuth {
13            username: "Sammwy_".to_string(),
14            access_token: None,
15            uuid: None,
16        },
17        game_dir: get_mc_dir(),
18        java_bin: PathBuf::from(
19            "C:\\Program Files\\Eclipse Adoptium\\jdk-17.0.7.7-hotspot\\bin\\java.exe",
20        ),
21        libraries_dir: get_mc_dir().join("libraries"),
22        manifest_file: get_mc_dir()
23            .join("versions")
24            .join("1.19.4")
25            .join("1.19.4.json"),
26        natives_dir: get_mc_dir().join("versions").join("1.19.4").join("natives"),
27        version: ClientVersion {
28            version: "1.19.4".to_string(),
29            version_type: "release".to_string(),
30        },
31        version_jar_file: get_mc_dir()
32            .join("versions")
33            .join("1.19.4")
34            .join("1.19.4.jar"),
35    });
36
37    bootstrap.launch().unwrap();
38}

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.