Fix various issues with the loading screen and datagen

Fix NPE on datagen startup
Fix early loading GUI hanging and never terminating after datagen
Add loading GUI messages for datagen
This commit is contained in:
tterrag 2020-04-28 00:00:45 -04:00
parent 903a400132
commit ea23cd4779
4 changed files with 11 additions and 2 deletions

View file

@ -9,7 +9,15 @@
}
public Collection<Path> func_200389_a() {
@@ -53,6 +53,10 @@
@@ -38,6 +38,7 @@
for(IDataProvider idataprovider : this.field_200396_d) {
field_200393_a.info("Starting provider: {}", (Object)idataprovider.func_200397_b());
+ net.minecraftforge.fml.StartupMessageManager.addModMessage("Generating: " + idataprovider.func_200397_b());
stopwatch1.start();
idataprovider.func_200398_a(directorycache);
stopwatch1.stop();
@@ -53,6 +54,10 @@
this.field_200396_d.add(p_200390_1_);
}

View file

@ -274,6 +274,7 @@ class ClientVisualization implements EarlyProgressVisualization.Visualization {
@Override
public Runnable start() {
initWindow();
renderThread.setDaemon(true); // Don't hang the game if it terminates before handoff (i.e. datagen)
renderThread.start();
return org.lwjgl.glfw.GLFW::glfwPollEvents;
}

View file

@ -292,7 +292,7 @@ public class ModLoader
dataGeneratorConfig = new GatherDataEvent.DataGeneratorConfig(mods, path, inputs, serverGenerators, clientGenerators, devToolGenerators, reportsGenerator, structureValidator);
existingFileHelper = new ExistingFileHelper(existingPacks, structureValidator);
gatherAndInitializeMods(() -> {});
dispatchAndHandleError(LifecycleEventProvider.GATHERDATA, Runnable::run, null);
dispatchAndHandleError(LifecycleEventProvider.GATHERDATA, Runnable::run, () -> {});
dataGeneratorConfig.runAll();
}