Skip to content

Commit

Permalink
Prevent mods from modifying the mod list
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedt committed Jan 12, 2025
1 parent 05a7b82 commit 0ac9ced
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions loader/src/main/java/net/neoforged/fml/ModList.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -46,9 +47,9 @@ public class ModList {
private List<ModContainer> sortedContainers;

private ModList(final List<ModFile> modFiles, final List<ModInfo> 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);
}

Expand Down

0 comments on commit 0ac9ced

Please sign in to comment.