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 String getModId(); 043 044 /** 045 * A human readable name 046 */ 047 048 String getName(); 049 050 /** 051 * A human readable version identifier 052 */ 053 String getVersion(); 054 055 /** 056 * The location on the file system which this mod came from 057 */ 058 File getSource(); 059 060 /** 061 * The metadata for this mod 062 */ 063 ModMetadata getMetadata(); 064 065 /** 066 * Attach this mod to it's metadata from the supplied metadata collection 067 */ 068 void bindMetadata(MetadataCollection mc); 069 070 /** 071 * Set the enabled/disabled state of this mod 072 */ 073 void setEnabledState(boolean enabled); 074 075 /** 076 * A list of the modids that this mod requires loaded prior to loading 077 */ 078 Set<ArtifactVersion> getRequirements(); 079 080 /** 081 * A list of modids that should be loaded prior to this one. The special 082 * value <strong>*</strong> indicates to load <em>before</em> any other mod. 083 */ 084 List<ArtifactVersion> getDependencies(); 085 086 /** 087 * A list of modids that should be loaded <em>after</em> this one. The 088 * special value <strong>*</strong> indicates to load <em>after</em> any 089 * other mod. 090 */ 091 List<ArtifactVersion> getDependants(); 092 093 /** 094 * A representative string encapsulating the sorting preferences for this 095 * mod 096 */ 097 String getSortingRules(); 098 099 /** 100 * Register the event bus for the mod and the controller for error handling 101 * Returns if this bus was successfully registered - disabled mods and other 102 * mods that don't need real events should return false and avoid further 103 * processing 104 * 105 * @param bus 106 * @param controller 107 */ 108 boolean registerBus(EventBus bus, LoadController controller); 109 110 /** 111 * Does this mod match the supplied mod 112 * 113 * @param mod 114 */ 115 boolean matches(Object mod); 116 117 /** 118 * Get the actual mod object 119 */ 120 Object getMod(); 121 122 ArtifactVersion getProcessedVersion(); 123 124 boolean isImmutable(); 125 126 boolean isNetworkMod(); 127 128 String getDisplayVersion(); 129 }