001    /*
002     * The FML Forge Mod Loader suite.
003     * Copyright (C) 2012 cpw
004     *
005     * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or any later version.
007     *
008     * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
009     * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
010     *
011     * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
012     * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
013     */
014    package cpw.mods.fml.common;
015    
016    import java.io.File;
017    import java.security.cert.Certificate;
018    import java.util.List;
019    import java.util.Set;
020    
021    import com.google.common.eventbus.EventBus;
022    
023    import cpw.mods.fml.common.versioning.ArtifactVersion;
024    import cpw.mods.fml.common.versioning.VersionRange;
025    
026    /**
027     * The container that wraps around mods in the system.
028     * <p>
029     * The philosophy is that individual mod implementation technologies should not
030     * impact the actual loading and management of mod code. This interface provides
031     * a mechanism by which we can wrap actual mod code so that the loader and other
032     * facilities can treat mods at arms length.
033     * </p>
034     *
035     * @author cpw
036     *
037     */
038    
039    public interface ModContainer
040    {
041        /**
042         * The globally unique modid for this mod
043         */
044        String getModId();
045    
046        /**
047         * A human readable name
048         */
049    
050        String getName();
051    
052        /**
053         * A human readable version identifier
054         */
055        String getVersion();
056    
057        /**
058         * The location on the file system which this mod came from
059         */
060        File getSource();
061    
062        /**
063         * The metadata for this mod
064         */
065        ModMetadata getMetadata();
066    
067        /**
068         * Attach this mod to it's metadata from the supplied metadata collection
069         */
070        void bindMetadata(MetadataCollection mc);
071    
072        /**
073         * Set the enabled/disabled state of this mod
074         */
075        void setEnabledState(boolean enabled);
076    
077        /**
078         * A list of the modids that this mod requires loaded prior to loading
079         */
080        Set<ArtifactVersion> getRequirements();
081    
082        /**
083         * A list of modids that should be loaded prior to this one. The special
084         * value <strong>*</strong> indicates to load <em>before</em> any other mod.
085         */
086        List<ArtifactVersion> getDependencies();
087    
088        /**
089         * A list of modids that should be loaded <em>after</em> this one. The
090         * special value <strong>*</strong> indicates to load <em>after</em> any
091         * other mod.
092         */
093        List<ArtifactVersion> getDependants();
094    
095        /**
096         * A representative string encapsulating the sorting preferences for this
097         * mod
098         */
099        String getSortingRules();
100    
101        /**
102         * Register the event bus for the mod and the controller for error handling
103         * Returns if this bus was successfully registered - disabled mods and other
104         * mods that don't need real events should return false and avoid further
105         * processing
106         *
107         * @param bus
108         * @param controller
109         */
110        boolean registerBus(EventBus bus, LoadController controller);
111    
112        /**
113         * Does this mod match the supplied mod
114         *
115         * @param mod
116         */
117        boolean matches(Object mod);
118    
119        /**
120         * Get the actual mod object
121         */
122        Object getMod();
123    
124        ArtifactVersion getProcessedVersion();
125    
126        boolean isImmutable();
127    
128        boolean isNetworkMod();
129    
130        String getDisplayVersion();
131    
132        VersionRange acceptableMinecraftVersionRange();
133    
134        Certificate getSigningCertificate();
135    }