pub struct Launch { /* private fields */ }Expand description
Launch struct represents the configuration for launching a Minecraft client.
This struct holds the arguments required to launch the Minecraft client. The arguments are passed as a single string, which can include various options supported by the Minecraft client.
Implementations§
Source§impl Launch
impl Launch
Sourcepub fn new(
args: Vec<String>,
java_exe: String,
jre: Option<PathBuf>,
offline: Option<bool>,
) -> Result<Self, LaunchError>
pub fn new( args: Vec<String>, java_exe: String, jre: Option<PathBuf>, offline: Option<bool>, ) -> Result<Self, LaunchError>
Launches a new instance of the launch function.
Sourcepub fn info(&self) -> (&str, &str, &Option<PathBuf>)
pub fn info(&self) -> (&str, &str, &Option<PathBuf>)
Returns the launch configuration information.
This method provides access to the arguments, Java executable path, and the optional Java Runtime Environment (JRE) path
that were used to initialize the Launch struct.
§Returns
(&str, &str, &Option<PathBuf>)- A tuple containing the final arguments string, the path to the Java executable, and an optional path to the Java Runtime Environment.
Sourcepub fn launch_jre(&self) -> Result<()>
pub fn launch_jre(&self) -> Result<()>
Launches the Java Runtime Environment (JRE) with the specified arguments.
This method is responsible for starting the Java Runtime Environment
with the arguments provided during the initialization of the Launch struct.
It is intended to be used for launching Minecraft or other Java applications.
Required Args:
- UUID: LauncherUUID
- Token: BearerToken
§Examples
use minecraft_essentials::Launch;
use std::path::Path;
let jre_path = Path::new("/path/to/jre").to_path_buf();
let launcher = Launch::new(vec!["-Xmx1024M --uuid --token".to_string()], "/path/to/java".to_string(), Some(jre_path), None).expect("Expected Launch");
launcher.launch_jre();