Fix translations in replay recovery gui

This commit is contained in:
Jonas Herzig
2019-05-22 10:41:41 +02:00
parent 41251a1e18
commit 5e407cc9aa
2 changed files with 25 additions and 14 deletions

View File

@@ -344,7 +344,7 @@ public class ReplayMod implements
testIfMoeshAndExitMinecraft();
runLater(() -> {
runPostStartup(() -> {
// Cleanup deleted corrupted replays
try {
File[] files = getReplayFolder().listFiles();
@@ -390,6 +390,27 @@ public class ReplayMod implements
}
}
/**
* Execute the given runnable after game has started (once the overlay has been closed).
* Most importantly, it will run after resources (including language keys!) have been loaded.
* Below 1.14, this is equivalent to {@link #runLater(Runnable)}.
*/
public void runPostStartup(Runnable runnable) {
runLater(new Runnable() {
@Override
public void run() {
//#if MC>=11400
if (getMinecraft().overlay != null) {
// delay until after resources have been loaded
runLater(this);
return;
}
//#endif
runnable.run();
}
});
}
/**
* Set when the currently running code has been scheduled by runLater.
* If this is the case, subsequent calls to runLater have to be delayed until all scheduled tasks have been