2 unstable releases

0.2.0 Jun 25, 2022
0.1.0 Jun 16, 2022

#140 in #net

MIT/Apache

59KB
1.5K SLoC

GitHub code size in bytes GitHub last commit

⚠ ATTENTION ⚠️

While minceraft isn't cancelled, I have suspended development to work on https://github.com/mine-rs/. When miners and craftrs are mostly finished, this repo/crate will likely be repurposed as a high level framework or implementation of sorts.

minceraft

Minceraft is a library for minecraft related stuff. Currently it is divided into 2 modules that have to be enabled as a feature:

  • net
  • auth

net

The net module provides an API for minecraft networking. It's primarily focussed at version 1.8.9 and clients, but you should be able to use it for servers and for other versions as well.

Auth

The auth module is for logging into a minecraft account by using the microsoft oauth2 device flow: https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-device-code It also caches the token with a custom binary format that is base64 encoded so you can easily copy paste it (although you should almost never need to do this!).

Example

use {ms_auth_mc::*, reqwest::blocking::Client};

let client = Client::new();
let device_code =
    DeviceCode::new("389b1b32-b5d5-43b2-bddc-84ce938d6737"/* You would ideally replace this with your own CID*/, None, &client).unwrap();
 
if let Some(inner) = &device_code.inner {
   println!("{}", inner.message);
}
 
let auth = device_code.authenticate(&client).unwrap();
println!("{}", auth.token);

You can create your own cid by making an azure application.

Dependencies

~1.6–2.4MB
~51K SLoC