Search in sources :

Example 1 with ModAnnotation

use of net.minecraftforge.fml.common.discovery.asm.ModAnnotation in project MinecraftForge by MinecraftForge.

the class ModContainerFactory method build.

@Nullable
public ModContainer build(ASMModParser modParser, File modSource, ModCandidate container) {
    String className = modParser.getASMType().getClassName();
    if (modParser.isBaseMod(container.getRememberedBaseMods()) && modClass.matcher(className).find()) {
        FMLLog.severe("Found a BaseMod type mod %s", className);
        FMLLog.severe("This will not be loaded and will be ignored. ModLoader mechanisms are no longer available.");
    } else if (modClass.matcher(className).find()) {
        FMLLog.fine("Identified a class %s following modloader naming convention but not directly a BaseMod or currently seen subclass", className);
        container.rememberModCandidateType(modParser);
    } else if (modParser.isBaseMod(container.getRememberedBaseMods())) {
        FMLLog.fine("Found a basemod %s of non-standard naming format", className);
        container.rememberBaseModType(className);
    }
    for (ModAnnotation ann : modParser.getAnnotations()) {
        if (modTypes.containsKey(ann.getASMType())) {
            FMLLog.fine("Identified a mod of type %s (%s) - loading", ann.getASMType(), className);
            try {
                ModContainer ret = modTypes.get(ann.getASMType()).newInstance(className, container, ann.getValues());
                if (!ret.shouldLoadInEnvironment()) {
                    FMLLog.fine("Skipping mod %s, container opted to not load.", className);
                    return null;
                }
                return ret;
            } catch (Exception e) {
                FMLLog.log(Level.ERROR, e, "Unable to construct %s container", ann.getASMType().getClassName());
                return null;
            }
        }
    }
    return null;
}
Also used : ModAnnotation(net.minecraftforge.fml.common.discovery.asm.ModAnnotation) Nullable(javax.annotation.Nullable)

Aggregations

Nullable (javax.annotation.Nullable)1 ModAnnotation (net.minecraftforge.fml.common.discovery.asm.ModAnnotation)1