Fix lazy ModContainer evaluation skipping thrown loadingExceptions
Fix formatting
This commit is contained in:
parent
180f16161c
commit
3c006c4ca4
1 changed files with 6 additions and 7 deletions
|
@ -26,16 +26,15 @@ import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||||
import net.minecraftforge.fml.config.ConfigTracker;
|
import net.minecraftforge.fml.config.ConfigTracker;
|
||||||
import net.minecraftforge.fml.config.ModConfig;
|
import net.minecraftforge.fml.config.ModConfig;
|
||||||
import net.minecraftforge.fml.loading.FMLPaths;
|
|
||||||
import net.minecraftforge.forgespi.language.IModInfo;
|
|
||||||
import net.minecraftforge.fml.loading.FMLLoader;
|
import net.minecraftforge.fml.loading.FMLLoader;
|
||||||
|
import net.minecraftforge.fml.loading.FMLPaths;
|
||||||
import net.minecraftforge.fml.loading.LoadingModList;
|
import net.minecraftforge.fml.loading.LoadingModList;
|
||||||
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
|
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
|
||||||
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
|
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
|
||||||
|
import net.minecraftforge.forgespi.language.IModInfo;
|
||||||
import net.minecraftforge.forgespi.language.IModLanguageProvider;
|
import net.minecraftforge.forgespi.language.IModLanguageProvider;
|
||||||
import net.minecraftforge.registries.GameData;
|
import net.minecraftforge.registries.GameData;
|
||||||
import net.minecraftforge.registries.ObjectHolderRegistry;
|
import net.minecraftforge.registries.ObjectHolderRegistry;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@ -45,7 +44,6 @@ import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
import static net.minecraftforge.fml.Logging.CORE;
|
import static net.minecraftforge.fml.Logging.CORE;
|
||||||
import static net.minecraftforge.fml.Logging.LOADING;
|
import static net.minecraftforge.fml.Logging.LOADING;
|
||||||
|
@ -118,15 +116,16 @@ public class ModLoader
|
||||||
if (!this.loadingExceptions.isEmpty()) {
|
if (!this.loadingExceptions.isEmpty()) {
|
||||||
throw new LoadingFailedException(loadingExceptions);
|
throw new LoadingFailedException(loadingExceptions);
|
||||||
}
|
}
|
||||||
final Stream<ModContainer> modContainerStream = loadingModList.getModFiles().stream().
|
final List<ModContainer> modContainers = loadingModList.getModFiles().stream().
|
||||||
map(ModFileInfo::getFile).
|
map(ModFileInfo::getFile).
|
||||||
map(mf -> buildMods(mf, launchClassLoader)).
|
map(mf -> buildMods(mf, launchClassLoader)).
|
||||||
flatMap(Collection::stream);
|
flatMap(Collection::stream).
|
||||||
|
collect(Collectors.toList());
|
||||||
if (!loadingExceptions.isEmpty()) {
|
if (!loadingExceptions.isEmpty()) {
|
||||||
LOGGER.fatal(CORE, "Failed to initialize mod containers");
|
LOGGER.fatal(CORE, "Failed to initialize mod containers");
|
||||||
throw new LoadingFailedException(loadingExceptions);
|
throw new LoadingFailedException(loadingExceptions);
|
||||||
}
|
}
|
||||||
modList.setLoadedMods(modContainerStream.collect(Collectors.toList()));
|
modList.setLoadedMods(modContainers);
|
||||||
dispatchAndHandleError(LifecycleEventProvider.CONSTRUCT);
|
dispatchAndHandleError(LifecycleEventProvider.CONSTRUCT);
|
||||||
GameData.fireCreateRegistryEvents(LifecycleEventProvider.CREATE_REGISTRIES, this::dispatchAndHandleError);
|
GameData.fireCreateRegistryEvents(LifecycleEventProvider.CREATE_REGISTRIES, this::dispatchAndHandleError);
|
||||||
ObjectHolderRegistry.findObjectHolders();
|
ObjectHolderRegistry.findObjectHolders();
|
||||||
|
|
Loading…
Reference in a new issue