Merge branch 'pull/5484' into 1.13.x

This commit is contained in:
cpw 2019-02-16 16:59:13 -05:00
commit ae01194a5e
No known key found for this signature in database
GPG key ID: 8EB3DF749553B1B7

View file

@ -26,16 +26,15 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.fml.config.ConfigTracker;
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.FMLPaths;
import net.minecraftforge.fml.loading.LoadingModList;
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
import net.minecraftforge.forgespi.language.IModInfo;
import net.minecraftforge.forgespi.language.IModLanguageProvider;
import net.minecraftforge.registries.GameData;
import net.minecraftforge.registries.ObjectHolderRegistry;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -45,7 +44,6 @@ import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static net.minecraftforge.fml.Logging.CORE;
import static net.minecraftforge.fml.Logging.LOADING;
@ -118,15 +116,16 @@ public class ModLoader
if (!this.loadingExceptions.isEmpty()) {
throw new LoadingFailedException(loadingExceptions);
}
final Stream<ModContainer> modContainerStream = loadingModList.getModFiles().stream().
final List<ModContainer> modContainers = loadingModList.getModFiles().stream().
map(ModFileInfo::getFile).
map(mf -> buildMods(mf, launchClassLoader)).
flatMap(Collection::stream);
flatMap(Collection::stream).
collect(Collectors.toList());
if (!loadingExceptions.isEmpty()) {
LOGGER.fatal(CORE, "Failed to initialize mod containers");
throw new LoadingFailedException(loadingExceptions);
}
modList.setLoadedMods(modContainerStream.collect(Collectors.toList()));
modList.setLoadedMods(modContainers);
dispatchAndHandleError(LifecycleEventProvider.CONSTRUCT);
GameData.fireCreateRegistryEvents(LifecycleEventProvider.CREATE_REGISTRIES, this::dispatchAndHandleError);
ObjectHolderRegistry.findObjectHolders();