001/* 002 * Forge Mod Loader 003 * Copyright (c) 2012-2013 cpw. 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser Public License v2.1 006 * which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 008 * 009 * Contributors: 010 * cpw - implementation 011 */ 012 013package cpw.mods.fml.common; 014 015import java.io.File; 016import java.security.cert.Certificate; 017import java.util.List; 018import java.util.Set; 019 020import com.google.common.eventbus.EventBus; 021 022import cpw.mods.fml.common.versioning.ArtifactVersion; 023import 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 038public 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>after</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>before</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 133 Certificate getSigningCertificate(); 134}