downloadClientJar method

Future<void> downloadClientJar(
  1. VersionInfo versionInfo,
  2. String versionId
)

Downloads the Minecraft client JAR file for the specified version.

versionInfo The version information containing download URLs.

versionId The Minecraft version identifier.

Throws an exception if the download fails.

Implementation

Future<void> downloadClientJar(
  VersionInfo versionInfo,
  String versionId,
) async {
  try {
    final libraryDownloader = LibraryDownloader(
      gameDir: _gameDir,
      onDownloadProgress: _onDownloadProgress,
      onOperationProgress: _onOperationProgress,
      progressReportRate: _progressReportRate,
    );

    await libraryDownloader.downloadClientJar(versionInfo, versionId);
    debugPrint('Downloaded client jar for $versionId');
  } catch (e) {
    debugPrint('Error downloading client jar: $e');
    throw Exception('Failed to download client jar: $e');
  }
}