    001    package cpw.mods.fml.common.event;
    002
    003    import java.io.File;
    004    import java.util.Properties;
    005
    006    import cpw.mods.fml.common.LoaderState.ModState;
    007    import cpw.mods.fml.common.FMLModContainer;
    008    import cpw.mods.fml.common.ModContainer;
    009    import cpw.mods.fml.common.ModMetadata;
    010    import cpw.mods.fml.common.discovery.ASMDataTable;
    011
    012    public class FMLPreInitializationEvent extends FMLStateEvent
    013    {
    014        private ModMetadata modMetadata;
    015        private File sourceFile;
    016        private File configurationDir;
    017        private File suggestedConfigFile;
    018        private ASMDataTable asmData;
    019        private ModContainer modContainer;
    020
    021        public FMLPreInitializationEvent(Object... data)
    022        {
    023            super(data);
    024            this.asmData = (ASMDataTable)data[0];
    025            this.configurationDir = (File)data[1];
    026        }
    027
    028        @Override
    029        public ModState getModState()
    030        {
    031            return ModState.PREINITIALIZED;
    032        }
    033
    034        @Override
    035        public void applyModContainer(ModContainer activeContainer)
    036        {
    037            this.modContainer = activeContainer;
    038            this.modMetadata = activeContainer.getMetadata();
    039            this.sourceFile = activeContainer.getSource();
    040            this.suggestedConfigFile = new File(configurationDir, activeContainer.getModId()+".cfg");
    041        }
    042
    043        public File getSourceFile()
    044        {
    045            return sourceFile;
    046        }
    047
    048        public ModMetadata getModMetadata()
    049        {
    050            return modMetadata;
    051        }
    052
    053        public File getModConfigurationDirectory()
    054        {
    055            return configurationDir;
    056        }
    057
    058        public File getSuggestedConfigurationFile()
    059        {
    060            return suggestedConfigFile;
    061        }
    062
    063        public ASMDataTable getAsmData()
    064        {
    065            return asmData;
    066        }
    067
    068        public Properties getVersionProperties()
    069        {
    070            if (this.modContainer instanceof FMLModContainer)
    071            {
    072                return ((FMLModContainer)this.modContainer).searchForVersionProperties();
    073            }
    074
    075            return null;
    076        }
    077    }