Search in sources :

Example 1 with IModLocator

use of net.minecraftforge.forgespi.locating.IModLocator in project MinecraftForge by MinecraftForge.

the class ModDiscoverer method discoverMods.

public ModValidator discoverMods() {
    LOGGER.debug(LogMarkers.SCAN, "Scanning for mods and other resources to load. We know {} ways to find mods", locatorList.size());
    var loadedFiles = new ArrayList<>();
    for (IModLocator locator : locatorList) {
        LOGGER.debug(LogMarkers.SCAN, "Trying locator {}", locator);
        var modFiles = locator.scanMods();
        for (IModFile mf : modFiles) {
            LOGGER.info(LogMarkers.SCAN, "Found mod file {} of type {} with locator {}", mf.getFileName(), mf.getType(), mf.getLocator());
            StartupMessageManager.modLoaderConsumer().ifPresent(c -> c.accept("Found mod file " + mf.getFileName() + " of type " + mf.getType()));
        }
        loadedFiles.addAll(modFiles);
    }
    final var modFilesMap = loadedFiles.stream().map(ModFile.class::cast).collect(Collectors.groupingBy(IModFile::getType));
    var validator = new ModValidator(modFilesMap);
    validator.stage1Validation();
    return validator;
}
Also used : IModFile(net.minecraftforge.forgespi.locating.IModFile) ArrayList(java.util.ArrayList) IModLocator(net.minecraftforge.forgespi.locating.IModLocator)

Aggregations

ArrayList (java.util.ArrayList)1 IModFile (net.minecraftforge.forgespi.locating.IModFile)1 IModLocator (net.minecraftforge.forgespi.locating.IModLocator)1