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