Coder Social home page Coder Social logo

mc-launcher-core's Introduction

mc-launcher-core

This is an mc launcher core written in Rust.

You can use the functions provided by this library to create an mc launcher, offering only basic functionalities.

Installation

Use cargo add mc-launcher-core to add it to your project.

Example

Here's an example of launching the latest version of mc offline:

use std::process::Command;

use mc_launcher_core::{
    auth::offline::get_offline_options,
    command::get_minecraft_command,
    install::install_minecraft_version,
    types::CallbackDict,
    utils::{get_latest_version, get_minecraft_directory},
};

fn main() {
    let options = get_offline_options("Steve");
    let latest_version = get_latest_version().unwrap().release;
    let minecraft_directory = get_minecraft_directory();

    let _ = install_minecraft_version(
        &latest_version,
        &minecraft_directory,
        &CallbackDict::default(),
    );

    let minecraft_command_result = get_minecraft_command(
        &get_latest_version().unwrap().release,
        &minecraft_directory,
        &options,
    );

    match minecraft_command_result {
        Ok(minecraft_command) => {
            // Start Minecraft
            let mut cmd = Command::new(&minecraft_command[0])
                .args(&minecraft_command[1..minecraft_command.len()])
                .spawn()
                .expect("Failed to start Minecraft");
            let _ = cmd.wait();
        }
        Err(err) => {
            eprintln!("Failed to get Minecraft command: {}", err);
        }
    }
}

Todo list

  • Crate library
  • Install original version
  • Offline launch
  • Microsoft account login
  • Support for Forge, Fabric, Quilt, and Liteloader
  • Install of mrpack modpacks
  • Comprehensive documentation

Note

  • There is still a lot of work to be done in this project. It is recommended to wait for version 0.1.0 before trying it out.
  • The aim of this project is to have a user-friendly launcher SDK library written in Rust.
  • During the development process, I referenced and learned from the minecraft-launcher-lib in Python libraries.

mc-launcher-core's People

Contributors

star-tears avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.