Traits

VersionInfo

The VersionInfo trait provides a generic interface for representing version information. It's implemented by VersionBuilder and LightyVersionBuilder.

Definition

pub trait VersionInfo: Clone + Send + Sync {
    type LoaderType: Clone + Send + Sync + std::fmt::Debug;

    fn name(&self) -> &str;
    fn loader_version(&self) -> &str;
    fn minecraft_version(&self) -> &str;
    fn game_dirs(&self) -> &Path;
    fn java_dirs(&self) -> &Path;
    fn loader(&self) -> &Self::LoaderType;

    // Helper methods
    fn game_dir_exists(&self) -> bool;
    fn java_dir_exists(&self) -> bool;
    fn full_identifier(&self) -> String;
    fn paths(&self) -> (&Path, &Path);
}

Exports

In lighty_loaders:

In lighty_launcher:

Methods

name() -> &str

Returns the instance name (unique identifier).

loader_version() -> &str

Returns the loader version string.

For Vanilla, this returns an empty string.

minecraft_version() -> &str

Returns the Minecraft version.

game_dirs() -> &Path

Returns the game directory path (contains versions, libraries, assets).

Structure:

java_dirs() -> &Path

Returns the Java runtime directory path.

Structure:

loader() -> &Loader

Returns the loader type.

game_dir_exists() -> bool

Checks if the game directory exists on disk.

java_dir_exists() -> bool

Checks if the Java directory exists.

full_identifier() -> String

Returns a complete identifier combining name, MC version, and loader version.

paths() -> (&Path, &Path)

Returns both game and Java directories as a tuple.

Usage Example

LoaderExtensions

The LoaderExtensions trait provides methods for fetching loader metadata. It's automatically implemented for any type that implements VersionInfo<LoaderType = Loader>.

Definition

Exports

In lighty_loaders:

In lighty_launcher:

Methods

get_metadata() -> Result<Arc>

Fetches complete metadata for the loader. This is the main method you should use.

Returns: Arc<VersionMetaData> containing:

  • id: Minecraft version

  • main_class: Entry point class

  • libraries: Vec of library dependencies

  • arguments: JVM and game arguments

  • asset_index: Asset information

  • And more...

Loader dispatch:

  • Vanilla → Vanilla manifest

  • Fabric → Vanilla + Fabric merged

  • Quilt → Vanilla + Quilt merged

  • NeoForge → NeoForge manifest

  • Forge → Forge manifest (in progress)

  • LightyUpdater → Custom server manifest

get_libraries() -> Result<Arc>

Fetches only library metadata (faster than full metadata).

Supported loaders: Vanilla, Fabric, Quilt NeoForge: Returns full metadata (no separate libraries query)

get_main_class() -> Result<Arc>

Fetches only the main class information.

Requires: vanilla feature Only for: Vanilla-based queries

get_natives() -> Result<Arc>

Fetches only native library information.

Requires: vanilla feature Only for: Vanilla-based queries

get_java_version() -> Result<Arc>

Fetches Java version requirement.

Requires: vanilla feature Only for: Vanilla-based queries

get_assets() -> Result<Arc>

Fetches asset information.

Requires: vanilla feature Only for: Vanilla-based queries

Usage Example

Error Handling

Custom Implementations

You can implement these traits for your own types:

Now MyCustomVersion can use all LoaderExtensions methods:

Last updated