Skip to content

nothendev/startmc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

startmc

A CLI tool and library for launching Minecraft clients.

Features

Run Minecraft

Run a Minecraft instance named default (config is ~/.config/startmc/default.toml):

startmc

Run using a custom startmc config file:

startmc ./myinstance.toml

Download content from the internet

Download mods:

startmc -U MOD_URL ANOTHER_MOD_URL MANY_MORE_MOD_URLS

Download resourcepacks:

startmc -U RESOURCEPACK_URL ANOTHER_RESOURCEPACK_URL MANY_MORE_RESOURCEPACK_URLS

(TODO) Download and update content from Modrinth (TODO) and CurseForge (TODO (TODO))

Download mods from Modrinth:

startmc -S fabric-api sodium

Update all your installed mods:

startmc -Syu

Installation

git clone https://github.com/startmc/startmc.git
cd startmc
cargo install --path .

Cross-compiling to Windows from Linux

  1. Install mingw-w64-gcc (this is for Arch Linux, for other distros it might be different)
sudo pacman -S mingw-w64-gcc
  1. Cross-compile!
cargo build --target x86_64-pc-windows-gnu --release
  1. The binary should be in target/x86_64-pc-windows-gnu/release/startmc.exe.

Usage as a library

You can use this library to integrate any part of startmc's functionality into your own program, or invoke it programmatically, or make a wrapper around it, or anything else that comes to your mind!

If you want to know more, please either generate API docs with cargo doc --package startmc --lib, or read the source code.

If you see bad docs, or library-unfriendly code, or whatever else that is making it harder to use, please open an issue or, if you want, fix it and open a PR, I will greatly appreciate it.

Examples

Invoke the CLI with your own args programmatically:

use startmc::cli::Cli;
let cli = Cli::parse_from(["startmc", "-I", "-m", "1.20.1", "-f", "0.16.9"]).unwrap();
cli.exec().await.unwrap();

Or construct it yourself:

use startmc::cli::*;

let cli = Cli {
    instance: "default".to_string(),
    command: CliCommand::Init(CliInit {
        version: Some("1.20.1".to_string()),
        fabric: Some("0.16.9".to_string()),
    }),
};

cli.exec().await.unwrap();

Use the cache:

use startmc::cache::*;
use startmc::mojapi::model::fabric::*;

let minecraft_version = "1.20.1";
let fabric_versions = use_cached_json::<FabricVersionsGame>(&format!(
    "{}/{minecraft_version}",
    FABRIC_VERSIONS_GAME
)).await.unwrap();

Credits

  • wiki.vg and all its contibutions for documenting, like, the entire asset, library, etc download and launch progress.
  • pacman for inspiration for the CLI interface. Seriously, it's awesome.

About

CLI for launching Minecraft clients

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages