use lighty_core::AppState;
use lighty_launcher::prelude::*;
use lighty_java::JavaDistribution;
const QUALIFIER: &str = "com";
const ORGANIZATION: &str = "MyLauncher";
const APPLICATION: &str = "";
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Initialize app state
let _app = AppState::new(
QUALIFIER.to_string(),
ORGANIZATION.to_string(),
APPLICATION.to_string(),
)?;
let launcher_dir = AppState::get_project_dirs();
// Create instance
let mut instance = VersionBuilder::new(
"my-instance",
Loader::Fabric,
"0.16.9",
"1.21.1",
launcher_dir
);
// Authenticate
let mut auth = OfflineAuth::new("Player123");
#[cfg(not(feature = "events"))]
let profile = auth.authenticate().await?;
#[cfg(feature = "events")]
let profile = auth.authenticate(None).await?;
// Launch the game
instance.launch(&profile, JavaDistribution::Temurin)
.run()
.await?;
Ok(())
}