Skip to content

A rust library that aims to make launchers for the game Minecraft

License

Notifications You must be signed in to change notification settings

knightmar/rust_launcher_lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Launcher Lib

This library was created to allow the creation of launchers for the minecraft video game, using the rust programming language.

Current state

The lib is in early development, some functionalities are already available but not much.

  • Vanilla install (versions > 1.13, other versions will be implemented soon)
  • Game launch (only on vanilla)
  • Authentication (Microsoft and offline)
  • Modloader installation (Forge, Fabric, Quilt, Neoforge)
  • Mod installation (CurseForge, Modrinth, personnal server)
  • Custom files

Code organisation

The code of this project is organized in a simple way:

  • src/auth: code for authenticating game accounts
  • src/launch: code to launch the game once the files have been downloaded
  • src/update: code for updating game files
  • lib.rs: main library file

How to use

First install this librairy into your project

Install

Then, to launch the game we need an Updater object (I'll use the 1.21 version of the game) :

let mut updater = Updater::new("1.21");

We need to specify the location of our launcher (In the AppData folder) :

updater.set_relative_local_dir_path(".rustLauncherLib");

And then install the game files :

updater.install_files();

Launch

For the moment, we have our files on the disk, let's launch the game :

let launcher = launch::GameLauncher::new(
    "1.21".to_string(),
    ".rustLauncherLib".to_string(),
    vec![], // the game arguments if you need to pass some
    vec![], // the jvm arguments
);
launcher.launch("access_token", "username").unwrap();

And here it is ! The game is launched.

For the people that don't want to understand what they are doing, here is the full code 😉 :

fn main() {
    let mut updater = Updater::new("1.21");
    updater.set_relative_local_dir_path(".rustLauncherLib");
    updater.install_files();

    let launcher = launch::GameLauncher::new(
        "1.21".to_string(),
        ".rustLauncherLib".to_string(),
        vec![],
        vec![],
    );
    launcher.launch("access_token", "username").unwrap();
}

Authentification

// todo

Librairies used

Here are the main librairies that i'm using on this project :

(The other libs I use can be found in cargo.toml file)

Thanks

This library is inspired by Flow Updater, a great library used to make launchers in Java. Go check the repo !

License

MIT License

Copyright (c) [year] [fullname]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A rust library that aims to make launchers for the game Minecraft

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages