DownloadAssetsEvent
Gets fired every time a new asset file has been downloaded.
Fields
Section titled “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 assets in bytes.
currentFileStringThe name or path of the asset currently being downloaded.
currentFileByteslongThe number of bytes downloaded for the current file.
currentFileSizelongThe total size of the current file in bytes.
When it fires
Section titled “When it fires”AssetDownloader downloads assets across a worker pool sized by LaunchConfiguration.downloadThreads (5 by default), so this event fires concurrently from multiple threads - one post per finished file, plus one final call once every future in the pool has completed to guarantee a progress: 1.0 event even if the last file was tiny.
Because progress/downloadedBytes/totalBytes describe the overall asset download (not just currentFile), don’t assume events arrive in a strict order by file - two threads can post around the same time with currentFile referring to whichever file each thread just finished. If you’re rendering a single progress bar, key off progress; if you want a live “currently downloading” list, track currentFile per listener call rather than assuming monotonic ordering.
This event is only posted when a non-null LaunchContext is available, which is always the case when assets are downloaded as part of Launcher.launchMinecraft(...).