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.lang.annotation.ElementType; 017 import java.lang.annotation.Retention; 018 import java.lang.annotation.RetentionPolicy; 019 import java.lang.annotation.Target; 020 021 import cpw.mods.fml.common.event.FMLInterModComms; 022 import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage; 023 024 import net.minecraft.src.ItemBlock; 025 026 /** 027 * The new mod style in FML 1.3 028 * 029 * @author cpw 030 * 031 */ 032 @Retention(RetentionPolicy.RUNTIME) 033 @Target(ElementType.TYPE) 034 public @interface Mod 035 { 036 /** 037 * The unique mod identifier for this mod 038 */ 039 String modid(); 040 /** 041 * A user friendly name for the mod 042 */ 043 String name() default ""; 044 /** 045 * A version string for this mod 046 */ 047 String version() default ""; 048 /** 049 * A simple dependency string for this mod (see modloader's "priorities" string specification) 050 */ 051 String dependencies() default ""; 052 /** 053 * Whether to use the mcmod.info metadata by default for this mod. 054 * If true, settings in the mcmod.info file will override settings in these annotations. 055 */ 056 boolean useMetadata() default false; 057 058 /** 059 * The acceptable range of minecraft versions that this mod will load and run in 060 * The default ("empty string") indicates that only the current minecraft version is acceptable. 061 * FML will refuse to run with an error if the minecraft version is not in this range across all mods. 062 * @return A version range as specified by the maven version range specification or the empty string 063 */ 064 String acceptedMinecraftVersions() default ""; 065 /** 066 * An optional bukkit plugin that will be injected into the bukkit plugin framework if 067 * this mod is loaded into the FML framework and the bukkit coremod is present. 068 * Instances of the bukkit plugin can be obtained via the {@link BukkitPluginRef} annotation on fields. 069 * @return 070 */ 071 String bukkitPlugin() default ""; 072 /** 073 * Mark the designated method as being called at the "pre-initialization" phase 074 * @author cpw 075 * 076 */ 077 @Retention(RetentionPolicy.RUNTIME) 078 @Target(ElementType.METHOD) 079 public @interface PreInit {} 080 /** 081 * Mark the designated method as being called at the "initialization" phase 082 * @author cpw 083 * 084 */ 085 @Retention(RetentionPolicy.RUNTIME) 086 @Target(ElementType.METHOD) 087 public @interface Init {} 088 /** 089 * Mark the designated method as being called at the "post-initialization" phase 090 * @author cpw 091 * 092 */ 093 @Retention(RetentionPolicy.RUNTIME) 094 @Target(ElementType.METHOD) 095 public @interface PostInit {} 096 /** 097 * Mark the designated method as being called at the "server-starting" phase 098 * @author cpw 099 * 100 */ 101 @Retention(RetentionPolicy.RUNTIME) 102 @Target(ElementType.METHOD) 103 public @interface ServerStarting {} 104 /** 105 * Mark the designated method as being called at the "server-started" phase 106 * @author cpw 107 * 108 */ 109 @Retention(RetentionPolicy.RUNTIME) 110 @Target(ElementType.METHOD) 111 public @interface ServerStarted {} 112 /** 113 * Mark the designated method as being called at the "server-stopping" phase 114 * @author cpw 115 * 116 */ 117 @Retention(RetentionPolicy.RUNTIME) 118 @Target(ElementType.METHOD) 119 public @interface ServerStopping {} 120 /** 121 * Mark the designated method as the receiver for {@link FMLInterModComms} messages 122 * Called between {@link Init} and {@link PostInit} 123 * @author cpw 124 * 125 */ 126 @Retention(RetentionPolicy.RUNTIME) 127 @Target(ElementType.METHOD) 128 public @interface IMCCallback {} 129 /** 130 * Populate the annotated field with the mod instance. 131 * @author cpw 132 * 133 */ 134 @Retention(RetentionPolicy.RUNTIME) 135 @Target(ElementType.FIELD) 136 public @interface Instance { 137 /** 138 * The mod object to inject into this field 139 */ 140 String value() default ""; 141 } 142 /** 143 * Populate the annotated field with the mod's metadata. 144 * @author cpw 145 * 146 */ 147 @Retention(RetentionPolicy.RUNTIME) 148 @Target(ElementType.FIELD) 149 public @interface Metadata { 150 /** 151 * The mod id specifying the metadata to load here 152 */ 153 String value() default ""; 154 } 155 /** 156 * Populate the annotated field with an instance of the Block as specified 157 * @author cpw 158 * 159 */ 160 @Retention(RetentionPolicy.RUNTIME) 161 @Target(ElementType.FIELD) 162 public @interface Block { 163 /** 164 * The block's name 165 */ 166 String name(); 167 /** 168 * The associated ItemBlock subtype for the item (can be null for an ItemBlock) 169 */ 170 Class<?> itemTypeClass() default ItemBlock.class; 171 } 172 /** 173 * Populate the annotated field with an Item 174 * @author cpw 175 * 176 */ 177 @Retention(RetentionPolicy.RUNTIME) 178 @Target(ElementType.FIELD) 179 public @interface Item { 180 /** 181 * The name of the item 182 */ 183 String name(); 184 /** 185 * The type of the item 186 */ 187 String typeClass(); 188 } 189 }