Update PLaunchApp.java
This commit is contained in:
1 parent
38083fb3c7
commit
17119d7bc6
1 file changed
+15
-12
@@ -18,7 +18,7 @@ public class PLaunchApp {
|
||||
public static JMinecraftVersionList.Version mVersion;
|
||||
public static boolean mIsAssetsProcessing = false;
|
||||
public static Thread[] assetThreads = new Thread[30];
|
||||
public static int assetThrIndex = -1;
|
||||
public static int assetThrIndex = 0;
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
// User might remove the minecraft folder, this can cause crashes, safety re-create it
|
||||
@@ -183,7 +183,7 @@ public class PLaunchApp {
|
||||
Map<String, JAssetInfo> assetsObjects = assets.objects;
|
||||
File objectsDir = new File(outputDir, "objects");
|
||||
for (JAssetInfo asset : assetsObjects.values()) {
|
||||
assetThreads[assetThrIndex++] = new Thread(() -> {
|
||||
assetThreads[assetThrIndex] = new Thread(() -> {
|
||||
|
||||
mIsAssetsProcessing = !UIKit.updateProgressSafe(currProgress / maxProgress, "Downloading " + assetsObjects.keySet().toArray(new String[0])[downloadedSs]);
|
||||
|
||||
@@ -202,16 +202,19 @@ public class PLaunchApp {
|
||||
downloadedSs++;
|
||||
|
||||
});
|
||||
|
||||
boolean isAllThreadsDone = false;
|
||||
while (!isAllThreadsDone) {
|
||||
isAllThreadsDone = true;
|
||||
for (int i = 0; i < assetThreads.length; i++) {
|
||||
Thread thr = assetThreads[i];
|
||||
isAllThreadsDone &= thr == null || !thr.isAlive();
|
||||
|
||||
if (thr != null && !thr.isAlive()) {
|
||||
assetThreads[i] = null;
|
||||
assetThreads[assetThrIndex].start();
|
||||
assetThrIndex++;
|
||||
|
||||
if (assetThrIndex == assetThreads.length) {
|
||||
boolean isAllThreadsDone = false;
|
||||
while (!isAllThreadsDone) {
|
||||
isAllThreadsDone = true;
|
||||
for (int i = 0; i < assetThreads.length; i++) {
|
||||
Thread thr = assetThreads[i];
|
||||
isAllThreadsDone &= thr == null || !thr.isAlive();
|
||||
if (thr != null && !thr.isAlive()) {
|
||||
assetThreads[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user