Skip to content
/ spuz Public

Tools to manage and launch minecraft programmatically

License

Notifications You must be signed in to change notification settings

coppebars/spuz

Repository files navigation

spuz_banner

Tools to manage and launch minecraft programmatically

Warning

Under Development

Some parts are still in the design stage and their API will constantly change and contain todo!()s or incompleted features with empty or panic!() functions.

Stable crates

Milestones

  • spuz_piston - Description of a variety of minecraft json specifications
    • Version manifest >1.12
    • Asset index
    • Listing
    • Launcher profile
    • Java runtimes manifest
    • Support for older versions <=1.12
    • Docs
  • spuz_spawner - Helpers for spawning java runtime
    • Spawning java
    • Easy way to apply argument changes
    • Crossplatform
    • Docs
  • spuz_wrench - Layers for spuz_spawner to configure java runtime command to launch game from version manifest
    • Support variables >1.12
    • Conditional arguments and libraries (depending on target os and arch) 1.19+
    • Friendly and typed builder
    • Docs
  • spuz_get - Pack of apis to get any versions of the game, even modded, such as fabric, quilt, forge, etc.
    • Vanilla
    • Fabric
    • Forge
    • Docs
  • spuz_folder - To manage minecraft installations, versions, instances, mods, etc...
    • under design

Examples

#[tokio::main]
async fn main() -> Result<()> {
  // Lookup for manifest and load it
  // We will later use `spuz_folder` for this once it is ready
  let manifest = todo!();

  // Use global java
  // Later we will use a local installation with right version
  let mut builder = CommandBuilder::new("java");
  // Apply allocation arguments: -Xms1024m -Xmx4096m
  builder.apply(AllocRange(1024..4096));

  // Setup launcher wrench
  let wrench = LauncherWrench::builder()
    .manifest(&manifest)
    .current_dir(&root)
    .game_dir(&game_dir)
    .build();

  // Apply wrench
  builder.apply(wrench);
  // Apply player settings
  builder.apply(Player::new("LIMPIX31", "268903ca-7946-400a-8984-1fdc0b8baf71"));
  // Window size
  builder.apply(WindowSize::new(1280, 720));
  // Set if you want start in fullscreen mode
  // builder.apply(Fullscreen);

  // Build and spawn process
  let process = builder.build().spawn()?;

  // Watch for logs
  while let Ok(log) = process.logs.recv().await {
    print!("{log}");
  }

  Ok(())
}

About

Tools to manage and launch minecraft programmatically

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages