// Path: src/main/java/com/openmodloader/api/IGameContext.java
// public interface IGameContext {
//     File getRunDirectory();
// 
//     @Nullable
//     MinecraftServer getServer();
// 
//     Side getPhysicalSide();
// }
// 
// Path: src/main/java/com/openmodloader/api/event/IEventDispatcher.java
// public interface IEventDispatcher {
//     <E extends IEvent> void dispatch(E event);
// }
// 
// Path: src/main/java/com/openmodloader/api/loader/ILanguageAdapter.java
// public interface ILanguageAdapter {
//     <T extends IModConfigurator> T constructConfigurator(Class<T> modClass) throws ModConstructionException;
// }
// 
// Path: src/main/java/com/openmodloader/api/loader/IModReporter.java
// public interface IModReporter {
//     void apply(ModReportCollector collector, ModConstructor constructor);
// }
// 
// Path: src/main/java/com/openmodloader/api/mod/Mod.java
// public class Mod {
//     private final ModMetadata metadata;
//     private final IModConfig config;
//     private final boolean global;
// 
//     public Mod(ModMetadata metadata, IModConfig config, boolean global) {
//         this.metadata = metadata;
//         this.config = config;
//         this.global = global;
//     }
// 
//     public ModMetadata getMetadata() {
//         return metadata;
//     }
// 
//     public IModConfig getConfig() {
//         return config;
//     }
// 
//     public boolean isGlobal() {
//         return global;
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (obj == this) return true;
//         if (obj == null || obj.getClass() != getClass()) return false;
// 
//         return ((Mod) obj).metadata.equals(metadata);
//     }
// 
//     @Override
//     public int hashCode() {
//         return this.metadata.hashCode();
//     }
// }
// 
// Path: src/main/java/com/openmodloader/api/mod/ModCandidate.java
// public class ModCandidate {
//     private final ModMetadata metadata;
//     private final IModConfigurator configurator;
//     private boolean global;
// 
//     public ModCandidate(ModMetadata metadata, IModConfigurator configurator) {
//         this.metadata = metadata;
//         this.configurator = configurator;
//     }
// 
//     public ModCandidate global() {
//         global = true;
//         return this;
//     }
// 
//     public boolean isGlobal() {
//         return global;
//     }
// 
//     public Mod construct() {
//         IModConfig config = configurator.initConfig();
//         configurator.configure(config);
// 
//         return new Mod(metadata, config, global);
//     }
// }
// 
// Path: src/main/java/com/openmodloader/api/mod/config/IRegistrationConfig.java
// public interface IRegistrationConfig {
//     <T> void registerEntries(IdRegistry<T> registry);
// }
// 
// Path: src/main/java/com/openmodloader/core/event/VoidEventDispatcher.java
// public final class VoidEventDispatcher implements IEventDispatcher {
//     public static final VoidEventDispatcher INSTANCE = new VoidEventDispatcher();
// 
//     private VoidEventDispatcher() {
//     }
// 
//     @Override
//     public <E extends IEvent> void dispatch(E event) {
//     }
// }


import com.github.zafarkhaja.semver.Version;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.openmodloader.api.IGameContext;
import com.openmodloader.api.event.IEventDispatcher;
import com.openmodloader.api.loader.ILanguageAdapter;
import com.openmodloader.api.loader.IModReporter;
import com.openmodloader.api.mod.Mod;
import com.openmodloader.api.mod.ModCandidate;
import com.openmodloader.api.mod.config.IRegistrationConfig;
import com.openmodloader.core.event.VoidEventDispatcher;
import net.minecraft.registry.IdRegistry;
import net.minecraft.registry.Registry;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
    public void initialize() {
        offerInstance(this);

        Collection<ModCandidate> installedCandidates = collectModCandidates();
        LOGGER.info("Collected {} mod candidates", installedCandidates.size());

        List<Mod> installedMods = installedCandidates.stream()
                .map(ModCandidate::construct)
                .collect(Collectors.toList());

        List<Mod> globalMods = installedMods.stream()
                .filter(Mod::isGlobal)
                .collect(Collectors.toList());

        installedModContext = new ModContext(installedMods);
        modContext = new ModContext(globalMods);

        eventDispatcher = modContext.buildEventDispatcher();

        for (Registry<?> registry : Registry.REGISTRIES) {
            if (registry instanceof IdRegistry) {
                initializeRegistry((IdRegistry<?>) registry);
            }
        }
    }

    private Collection<ModCandidate> collectModCandidates() {
        ModReportCollector reportCollector = new ModReportCollector();
        ModConstructor constructor = new ModConstructor(this.languageAdapters);

// Path: src/main/java/com/openmodloader/api/IGameContext.java
// public interface IGameContext {
//     File getRunDirectory();
// 
//     @Nullable
//     MinecraftServer getServer();
// 
//     Side getPhysicalSide();
// }
// 
// Path: src/main/java/com/openmodloader/api/event/IEventDispatcher.java
// public interface IEventDispatcher {
//     <E extends IEvent> void dispatch(E event);
// }
// 
// Path: src/main/java/com/openmodloader/api/loader/ILanguageAdapter.java
// public interface ILanguageAdapter {
//     <T extends IModConfigurator> T constructConfigurator(Class<T> modClass) throws ModConstructionException;
// }
// 
// Path: src/main/java/com/openmodloader/api/loader/IModReporter.java
// public interface IModReporter {
//     void apply(ModReportCollector collector, ModConstructor constructor);
// }
// 
// Path: src/main/java/com/openmodloader/api/mod/Mod.java
// public class Mod {
//     private final ModMetadata metadata;
//     private final IModConfig config;
//     private final boolean global;
// 
//     public Mod(ModMetadata metadata, IModConfig config, boolean global) {
//         this.metadata = metadata;
//         this.config = config;
//         this.global = global;
//     }
// 
//     public ModMetadata getMetadata() {
//         return metadata;
//     }
// 
//     public IModConfig getConfig() {
//         return config;
//     }
// 
//     public boolean isGlobal() {
//         return global;
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (obj == this) return true;
//         if (obj == null || obj.getClass() != getClass()) return false;
// 
//         return ((Mod) obj).metadata.equals(metadata);
//     }
// 
//     @Override
//     public int hashCode() {
//         return this.metadata.hashCode();
//     }
// }
// 
// Path: src/main/java/com/openmodloader/api/mod/ModCandidate.java
// public class ModCandidate {
//     private final ModMetadata metadata;
//     private final IModConfigurator configurator;
//     private boolean global;
// 
//     public ModCandidate(ModMetadata metadata, IModConfigurator configurator) {
//         this.metadata = metadata;
//         this.configurator = configurator;
//     }
// 
//     public ModCandidate global() {
//         global = true;
//         return this;
//     }
// 
//     public boolean isGlobal() {
//         return global;
//     }
// 
//     public Mod construct() {
//         IModConfig config = configurator.initConfig();
//         configurator.configure(config);
// 
//         return new Mod(metadata, config, global);
//     }
// }
// 
// Path: src/main/java/com/openmodloader/api/mod/config/IRegistrationConfig.java
// public interface IRegistrationConfig {
//     <T> void registerEntries(IdRegistry<T> registry);
// }
// 
// Path: src/main/java/com/openmodloader/core/event/VoidEventDispatcher.java
// public final class VoidEventDispatcher implements IEventDispatcher {
//     public static final VoidEventDispatcher INSTANCE = new VoidEventDispatcher();
// 
//     private VoidEventDispatcher() {
//     }
// 
//     @Override
//     public <E extends IEvent> void dispatch(E event) {
//     }
// }


// Path: src/main/java/com/openmodloader/loader/OpenModLoader.java
import com.github.zafarkhaja.semver.Version;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.openmodloader.api.IGameContext;
import com.openmodloader.api.event.IEventDispatcher;
import com.openmodloader.api.loader.ILanguageAdapter;
import com.openmodloader.api.loader.IModReporter;
import com.openmodloader.api.mod.Mod;
import com.openmodloader.api.mod.ModCandidate;
import com.openmodloader.api.mod.config.IRegistrationConfig;
import com.openmodloader.core.event.VoidEventDispatcher;
import net.minecraft.registry.IdRegistry;
import net.minecraft.registry.Registry;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

    public void initialize() {
        offerInstance(this);

        Collection<ModCandidate> installedCandidates = collectModCandidates();
        LOGGER.info("Collected {} mod candidates", installedCandidates.size());

        List<Mod> installedMods = installedCandidates.stream()
                .map(ModCandidate::construct)
                .collect(Collectors.toList());

        List<Mod> globalMods = installedMods.stream()
                .filter(Mod::isGlobal)
                .collect(Collectors.toList());

        installedModContext = new ModContext(installedMods);
        modContext = new ModContext(globalMods);

        eventDispatcher = modContext.buildEventDispatcher();

        for (Registry<?> registry : Registry.REGISTRIES) {
            if (registry instanceof IdRegistry) {
                initializeRegistry((IdRegistry<?>) registry);
            }
        }
    }

    private Collection<ModCandidate> collectModCandidates() {
        ModReportCollector reportCollector = new ModReportCollector();
        ModConstructor constructor = new ModConstructor(this.languageAdapters);

        for (IModReporter reporter : modReporters) {