From 6a1337aa92365420290a0533937adbc2b6e26890 Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 11 May 2019 20:47:27 -0400 Subject: [PATCH] Updated a couple of libraries. Fixed bug where modid could be in toml but not found during loading, yet game continued to load. Signed-off-by: cpw --- build.gradle | 4 ++-- src/main/java/net/minecraftforge/fml/ModLoader.java | 12 ++++++++++-- src/main/resources/assets/forge/lang/en_us.json | 1 + 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index e2875dc98..3eafb0d4e 100644 --- a/build.gradle +++ b/build.gradle @@ -310,9 +310,9 @@ project(':forge') { installer 'org.ow2.asm:asm:6.2' installer 'org.ow2.asm:asm-commons:6.2' installer 'org.ow2.asm:asm-tree:6.2' - installer 'cpw.mods:modlauncher:1.0.+' + installer 'cpw.mods:modlauncher:1.1.+' installer 'net.minecraftforge:accesstransformers:0.16.+:shadowed' - installer 'net.minecraftforge:eventbus:0.8.+:service' + installer 'net.minecraftforge:eventbus:0.9.+:service' installer 'net.minecraftforge:forgespi:0.12.+' installer 'net.minecraftforge:coremods:0.4.+' installer 'net.minecraftforge:unsafe:0.2.+' diff --git a/src/main/java/net/minecraftforge/fml/ModLoader.java b/src/main/java/net/minecraftforge/fml/ModLoader.java index 21170287c..75a18564d 100644 --- a/src/main/java/net/minecraftforge/fml/ModLoader.java +++ b/src/main/java/net/minecraftforge/fml/ModLoader.java @@ -166,8 +166,16 @@ public class ModLoader final Map modInfoMap = modFile.getModFileInfo().getMods().stream().collect(Collectors.toMap(IModInfo::getModId, Function.identity())); LOGGER.debug(LOADING, "ModContainer is {}", ModContainer.class.getClassLoader()); - return modFile.getScanResult().getTargets().entrySet().stream(). - map(e-> buildModContainerFromTOML(modFile, modClassLoader, modInfoMap, e)).collect(Collectors.toList()); + final List containers = modFile.getScanResult().getTargets().entrySet().stream(). + map(e -> buildModContainerFromTOML(modFile, modClassLoader, modInfoMap, e)).collect(Collectors.toList()); + if (containers.size() != modInfoMap.size()) { + LOGGER.fatal(LOADING,"File {} constructed {} mods: {}, but had {} mods specified: {}", + modFile.getFilePath(), + containers.size(), containers.stream().map(ModContainer::getModId).collect(Collectors.toList()), + modInfoMap.size(), modInfoMap.values().stream().map(IModInfo::getModId).collect(Collectors.toList())); + loadingExceptions.add(new ModLoadingException(null, ModLoadingStage.CONSTRUCT, "fml.modloading.missingclasses", null, modFile.getFilePath())); + } + return containers; } private ModContainer buildModContainerFromTOML(final ModFile modFile, final TransformingClassLoader modClassLoader, final Map modInfoMap, final Map.Entry idToProviderEntry) { diff --git a/src/main/resources/assets/forge/lang/en_us.json b/src/main/resources/assets/forge/lang/en_us.json index 1851d5d1f..e93b2fa9c 100644 --- a/src/main/resources/assets/forge/lang/en_us.json +++ b/src/main/resources/assets/forge/lang/en_us.json @@ -33,6 +33,7 @@ "fml.loadingerrorscreen.errorheader": "Error loading mods\n{0,choice,1#1 error has|1<{0} errors have} occurred during loading", "fml.loadingerrorscreen.warningheader": "{0,choice,1#Warning|1