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.util.List;
018 import java.util.Set;
019
020 import com.google.common.eventbus.EventBus;
021
022 import cpw.mods.fml.common.versioning.ArtifactVersion;
023 import cpw.mods.fml.common.versioning.VersionRange;
024
025 /**
026 * The container that wraps around mods in the system.
027 * <p>
028 * The philosophy is that individual mod implementation technologies should not
029 * impact the actual loading and management of mod code. This interface provides
030 * a mechanism by which we can wrap actual mod code so that the loader and other
031 * facilities can treat mods at arms length.
032 * </p>
033 *
034 * @author cpw
035 *
036 */
037
038 public interface ModContainer
039 {
040 /**
041 * The globally unique modid for this mod
042 */
043 String getModId();
044
045 /**
046 * A human readable name
047 */
048
049 String getName();
050
051 /**
052 * A human readable version identifier
053 */
054 String getVersion();
055
056 /**
057 * The location on the file system which this mod came from
058 */
059 File getSource();
060
061 /**
062 * The metadata for this mod
063 */
064 ModMetadata getMetadata();
065
066 /**
067 * Attach this mod to it's metadata from the supplied metadata collection
068 */
069 void bindMetadata(MetadataCollection mc);
070
071 /**
072 * Set the enabled/disabled state of this mod
073 */
074 void setEnabledState(boolean enabled);
075
076 /**
077 * A list of the modids that this mod requires loaded prior to loading
078 */
079 Set<ArtifactVersion> getRequirements();
080
081 /**
082 * A list of modids that should be loaded prior to this one. The special
083 * value <strong>*</strong> indicates to load <em>before</em> any other mod.
084 */
085 List<ArtifactVersion> getDependencies();
086
087 /**
088 * A list of modids that should be loaded <em>after</em> this one. The
089 * special value <strong>*</strong> indicates to load <em>after</em> any
090 * other mod.
091 */
092 List<ArtifactVersion> getDependants();
093
094 /**
095 * A representative string encapsulating the sorting preferences for this
096 * mod
097 */
098 String getSortingRules();
099
100 /**
101 * Register the event bus for the mod and the controller for error handling
102 * Returns if this bus was successfully registered - disabled mods and other
103 * mods that don't need real events should return false and avoid further
104 * processing
105 *
106 * @param bus
107 * @param controller
108 */
109 boolean registerBus(EventBus bus, LoadController controller);
110
111 /**
112 * Does this mod match the supplied mod
113 *
114 * @param mod
115 */
116 boolean matches(Object mod);
117
118 /**
119 * Get the actual mod object
120 */
121 Object getMod();
122
123 ArtifactVersion getProcessedVersion();
124
125 boolean isImmutable();
126
127 boolean isNetworkMod();
128
129 String getDisplayVersion();
130
131 VersionRange acceptableMinecraftVersionRange();
132 }