Fix stupid bug introduced with the refactor..

Signed-off-by: cpw <cpw+github@weeksfamily.ca>
This commit is contained in:
cpw 2019-06-22 19:08:49 -04:00
parent 389bc1ecea
commit 89006458a2
No known key found for this signature in database
GPG key ID: 8EB3DF749553B1B7

View file

@ -24,7 +24,6 @@ import net.minecraft.client.resources.DownloadingPackFinder;
import net.minecraft.client.resources.ClientResourcePackInfo; import net.minecraft.client.resources.ClientResourcePackInfo;
import net.minecraft.profiler.IProfiler; import net.minecraft.profiler.IProfiler;
import net.minecraft.resources.*; import net.minecraft.resources.*;
import net.minecraft.util.Unit;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ForgeConfig; import net.minecraftforge.common.ForgeConfig;
@ -58,19 +57,19 @@ public class ClientModLoader
ClientModLoader.mc = minecraft; ClientModLoader.mc = minecraft;
SidedProvider.setClient(()->minecraft); SidedProvider.setClient(()->minecraft);
LogicalSidedProvider.setClient(()->minecraft); LogicalSidedProvider.setClient(()->minecraft);
runTaskWithCatch(ModLoader.get()::gatherAndInitializeMods); createRunnableWithCatch(ModLoader.get()::gatherAndInitializeMods).run();
ResourcePackLoader.loadResourcePacks(defaultResourcePacks); ResourcePackLoader.loadResourcePacks(defaultResourcePacks);
mcResourceManager.addReloadListener(ClientModLoader::onreload); mcResourceManager.addReloadListener(ClientModLoader::onreload);
mcResourceManager.addReloadListener(BrandingControl.resourceManagerReloadListener()); mcResourceManager.addReloadListener(BrandingControl.resourceManagerReloadListener());
} }
private static CompletableFuture<Void> onreload(final IFutureReloadListener.IStage stage, final IResourceManager resourceManager, final IProfiler prepareProfiler, final IProfiler executeProfiler, final Executor asyncExecutor, final Executor syncExecutor) { private static CompletableFuture<Void> onreload(final IFutureReloadListener.IStage stage, final IResourceManager resourceManager, final IProfiler prepareProfiler, final IProfiler executeProfiler, final Executor asyncExecutor, final Executor syncExecutor) {
return CompletableFuture.runAsync(runTaskWithCatch(ModLoader.get()::loadMods), syncExecutor). return CompletableFuture.runAsync(createRunnableWithCatch(ModLoader.get()::loadMods), syncExecutor).
thenCompose(stage::markCompleteAwaitingOthers). thenCompose(stage::markCompleteAwaitingOthers).
thenRunAsync(runTaskWithCatch(ClientModLoader::end)); thenRunAsync(ClientModLoader::end);
} }
private static Runnable runTaskWithCatch(Runnable r) { private static Runnable createRunnableWithCatch(Runnable r) {
return ()-> { return ()-> {
try { try {
r.run(); r.run();
@ -83,7 +82,7 @@ public class ClientModLoader
public static void end() public static void end()
{ {
runTaskWithCatch(ModLoader.get()::finishMods); createRunnableWithCatch(ModLoader.get()::finishMods).run();
loading = false; loading = false;
mc.gameSettings.loadOptions(); mc.gameSettings.loadOptions();
} }
@ -127,10 +126,4 @@ public class ClientModLoader
{ {
return loading; return loading;
} }
private static void TEMP_printLoadingExceptions(LoadingFailedException error)
{
error.getErrors().forEach(e -> LOGGER.error("Exception: " + e.formatToString()));
throw new RuntimeException(error);
}
} }