Events/Launch/minified-launch

DownloadLibrariesEvent

Gets fired every time a new library file has been downloaded

Fields

progressdouble

The overall download progress as a value from 0.0 to 1.0

Accessor: progress()
downloadedByteslong

The total number of bytes downloaded so far

Accessor: downloadedBytes()
totalByteslong

The total size of all libraries in bytes

Accessor: totalBytes()
currentFileString

The name or path of the library currently being downloaded

Accessor: currentFile()
currentFileByteslong

The number of bytes downloaded for the current file

Accessor: currentFileBytes()
currentFileSizelong

The total size of the current file in bytes

Accessor: currentFileSize()

When it fires

Like DownloadAssetsEvent, LibraryDownloader runs on a fixed thread pool sized by LaunchConfiguration.downloadThreads, so this event fires from multiple threads concurrently - one post per finished library, with the running progress/downloadedBytes totals shared across the whole download.

LibraryDownloader performs its own connectivity check before starting, independently of Launcher's. If that check fails, it does not post OfflineEvent - it silently falls back to OfflineLibraryValidator, which verifies previously downloaded libraries already exist on disk instead of downloading anything. In that fallback path, DownloadLibrariesEvent never fires at all.

Listening

Subscribe on the EventBus the event is posted to, see Events for which bus that is.

eventBus.subscribe(DownloadLibrariesEvent.class, event -> {
    double progress = event.progress();
    long downloadedBytes = event.downloadedBytes();
    long totalBytes = event.totalBytes();
    String currentFile = event.currentFile();
    long currentFileBytes = event.currentFileBytes();
    long currentFileSize = event.currentFileSize();
});

Posted by

API reference: com.dervarex.minified.launch.events.download.libraries.DownloadLibrariesEvent