Events/Launch/minified-launch
DownloadLibrariesEvent
Gets fired every time a new library file has been downloaded
Fields
progressdoubleThe overall download progress as a value from 0.0 to 1.0
downloadedByteslongThe total number of bytes downloaded so far
totalByteslongThe total size of all libraries in bytes
currentFileStringThe name or path of the library currently being downloaded
currentFileByteslongThe number of bytes downloaded for the current file
currentFileSizelongThe total size of the current file in bytes
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();
});eventBus.subscribe(DownloadLibrariesEvent::class.java) { event ->
val progress = event.progress()
val downloadedBytes = event.downloadedBytes()
val totalBytes = event.totalBytes()
val currentFile = event.currentFile()
val currentFileBytes = event.currentFileBytes()
val currentFileSize = event.currentFileSize()
}Posted by
API reference: com.dervarex.minified.launch.events.download.libraries.DownloadLibrariesEvent