    001    package cpw.mods.fml.common.discovery;
    002
    003    import java.io.File;
    004    import java.util.List;
    005
    006    import com.google.common.collect.Lists;
    007
    008    import cpw.mods.fml.common.FMLLog;
    009    import cpw.mods.fml.common.ModContainer;
    010    import cpw.mods.fml.common.discovery.asm.ASMModParser;
    011
    012
    013    public class ModCandidate
    014    {
    015        private File classPathRoot;
    016        private File modContainer;
    017        private ContainerType sourceType;
    018        private boolean classpath;
    019        private List<String> baseModTypes = Lists.newArrayList();
    020        private boolean isMinecraft;
    021        private List<ASMModParser> baseModCandidateTypes = Lists.newArrayListWithCapacity(1);
    022
    023        public ModCandidate(File classPathRoot, File modContainer, ContainerType sourceType)
    024        {
    025            this(classPathRoot, modContainer, sourceType, false, false);
    026        }
    027        public ModCandidate(File classPathRoot, File modContainer, ContainerType sourceType, boolean isMinecraft, boolean classpath)
    028        {
    029            this.classPathRoot = classPathRoot;
    030            this.modContainer = modContainer;
    031            this.sourceType = sourceType;
    032            this.isMinecraft = isMinecraft;
    033            this.classpath = classpath;
    034        }
    035
    036        public File getClassPathRoot()
    037        {
    038            return classPathRoot;
    039        }
    040
    041        public File getModContainer()
    042        {
    043            return modContainer;
    044        }
    045
    046        public ContainerType getSourceType()
    047        {
    048            return sourceType;
    049        }
    050        public List<ModContainer> explore(ASMDataTable table)
    051        {
    052            List<ModContainer> mods = sourceType.findMods(this, table);
    053            if (!baseModCandidateTypes.isEmpty())
    054            {
    055                FMLLog.info("Attempting to reparse the mod container %s", getModContainer().getName());
    056                return sourceType.findMods(this, table);
    057            }
    058            else
    059            {
    060                return mods;
    061            }
    062        }
    063
    064        public boolean isClasspath()
    065        {
    066            return classpath;
    067        }
    068        public void rememberBaseModType(String className)
    069        {
    070            baseModTypes.add(className);
    071        }
    072        public List<String> getRememberedBaseMods()
    073        {
    074            return baseModTypes;
    075        }
    076        public boolean isMinecraftJar()
    077        {
    078            return isMinecraft;
    079        }
    080        public void rememberModCandidateType(ASMModParser modParser)
    081        {
    082            baseModCandidateTypes.add(modParser);
    083        }
    084    }