diff --git a/loader/src/main/java/net/neoforged/fml/ModList.java b/loader/src/main/java/net/neoforged/fml/ModList.java index 8c309a34e..9de555ba9 100644 --- a/loader/src/main/java/net/neoforged/fml/ModList.java +++ b/loader/src/main/java/net/neoforged/fml/ModList.java @@ -9,6 +9,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Locale; @@ -46,9 +47,9 @@ public class ModList { private List sortedContainers; private ModList(final List modFiles, final List sortedList) { - this.modFiles = modFiles.stream().map(ModFile::getModFileInfo).map(ModFileInfo.class::cast).collect(Collectors.toList()); - this.sortedList = sortedList.stream().map(ModInfo.class::cast).collect(Collectors.toList()); - this.fileById = this.modFiles.stream().map(IModFileInfo::getMods).flatMap(Collection::stream).map(ModInfo.class::cast).collect(Collectors.toMap(ModInfo::getModId, ModInfo::getOwningFile)); + this.modFiles = modFiles.stream().map(ModFile::getModFileInfo).toList(); + this.sortedList = sortedList.stream().map(IModInfo.class::cast).toList(); + this.fileById = Collections.unmodifiableMap(this.modFiles.stream().map(IModFileInfo::getMods).flatMap(Collection::stream).map(ModInfo.class::cast).collect(Collectors.toMap(ModInfo::getModId, ModInfo::getOwningFile))); CrashReportCallables.registerCrashCallable("Mod List", this::crashReport); }