Crates.io | minecraft-essentials |
lib.rs | minecraft-essentials |
version | 0.2.11 |
source | src |
created_at | 2024-01-31 22:27:42.377477 |
updated_at | 2024-04-22 04:09:09.041162 |
description | A Package that gives all Minecraft client launchers essentials. |
homepage | https://minecraft-essentials.github.io |
repository | https://github.com/minecraft-essentials/minecraft-essentials |
max_upload_size | |
id | 1122260 |
size | 113,823 |
The offical rust/cargo package that provides essential functionality for Minecraft client launchers.
If your looking to use a package other than rust/cargo you might want to have a look at:
Add minecraft-essentials
to your project:
cargo add minecraft-essentials
OR
Add the following to your Cargo.toml
:
[dependencies]
minecraft-essentials = "0.2.9"
This example demonstrates how to use the OAuth authentication method provided by minecraft-essentials
, oauth
feature.
use minecraft_essentials::*;
async fn Oauth(client_id: &str, client_secret: &str, port: Option<u16>, bedrockrel: bool) {
// Initialize the OAuth authentication object
let auth = Oauth::new(client_id, port);
// Print the URL needed for authentication
println!("URL: {}", auth.url());
// Launch the authentication process
let auth_info = auth.launch(bedrockrel, client_secret).await;
// Print the authentication information
println!("{:?}", auth_info)
}
fn main() {
Oauth("CLientID", "ClientSecret", None, false);
}
[!WARNING] This is still work in progress so it may change.
This example demonstrates how to use the Device Code authentication method provided by minecraft-essentials
, devicecode
feature.
use minecraft_essentials::*;
async fn deviceCode(client_id: &str) {
// Create a new device code instance
let code = DeviceCode::new(client_id).expect("Expected Code");
// Print the device code information
println!("Stuff Here: {}", code.preinfo());
// Launch the authentication process
let code_info = code.launch().await?;
}
fn main() {
// Initialize Device Code authentication with your client ID
deviceCode("111231209837123098712");
}
[!CAUTION] This is currently in the roadmap for 0.2.12-14 currently it's not avalible.
use minecraft_essentials::Launch;
use std::path::Path;
let args = vec!["--uuid:LauncherUUID".to_string(), "--token:Beartoken".to_string()];
let jre_path = Path::new("/path/to/jre").to_path_buf();
let java_exe = "/your/java/path";
// Init the instance of launch
let launch = Launch::new(args, java_exe.to_string(), Some(jre_path.clone()), Some(false)).expect("Expected Launch");
// Grab the info to verify that your doing everything currect.
let launch_info = launch.info();
println!("Launching with: {:?}", launch_info);
let _ = launch.launch_jre();
Interested in contributing to this project? Check out Contributing.
This library is licensed under the BSD 3.0 License.
trippleawap for providing a Minecraft Authentication Sample for Minecraft Implementation.