mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-15 10:25:06 -04:00
fix minecraft assets downloading
This commit is contained in:
parent
e72aab9f74
commit
cfd492eee4
@ -46,7 +46,7 @@ class MinecraftAssetsManager(
|
|||||||
if (!verifyAssetHash(assetVersion.indexHash!!)) {
|
if (!verifyAssetHash(assetVersion.indexHash!!)) {
|
||||||
downloadAssetsIndex()
|
downloadAssetsIndex()
|
||||||
}
|
}
|
||||||
this.assetsMapping.putAll(verifyAssets(AssetsSource.MOJANG, latch!!, parseAssetsIndex(assetVersion.indexHash)))
|
this.assetsMapping.putAll(verifyAssets(AssetsSource.MINECRAFT, latch, parseAssetsIndex(assetVersion.indexHash)))
|
||||||
|
|
||||||
// generate jar assets index
|
// generate jar assets index
|
||||||
generateJarAssets()
|
generateJarAssets()
|
||||||
@ -132,19 +132,19 @@ class MinecraftAssetsManager(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun verifyAssets(source: AssetsSource, latch: CountUpAndDownLatch, assets: Map<ResourceLocation, String>): Map<ResourceLocation, String> {
|
private fun verifyAssets(source: AssetsSource, latch: CountUpAndDownLatch?, assets: Map<ResourceLocation, String>): Map<ResourceLocation, String> {
|
||||||
val assetsLatch = CountUpAndDownLatch(assets.size)
|
val assetsLatch = CountUpAndDownLatch(assets.size)
|
||||||
latch.addCount(assets.size)
|
latch?.addCount(assets.size)
|
||||||
for (hash in assets.values) {
|
for (hash in assets.values) {
|
||||||
Minosoft.THREAD_POOL.execute {
|
Minosoft.THREAD_POOL.execute {
|
||||||
val compressed = source == AssetsSource.MOJANG
|
val compressed = source != AssetsSource.PIXLYZER
|
||||||
if (StaticConfiguration.DEBUG_SLOW_LOADING) {
|
if (StaticConfiguration.DEBUG_SLOW_LOADING) {
|
||||||
Thread.sleep(100L)
|
Thread.sleep(100L)
|
||||||
}
|
}
|
||||||
if (!verifyAssetHash(hash, compressed)) {
|
if (!verifyAssetHash(hash, compressed)) {
|
||||||
downloadAsset(source, hash)
|
downloadAsset(source, hash)
|
||||||
}
|
}
|
||||||
latch.countDown()
|
latch?.countDown()
|
||||||
assetsLatch.countDown()
|
assetsLatch.countDown()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user