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