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         * Mark the designated method as being called at the "pre-initialization" phase
057         * @author cpw
058         *
059         */
060        @Retention(RetentionPolicy.RUNTIME)
061        @Target(ElementType.METHOD)
062        public @interface PreInit {}
063        /**
064         * Mark the designated method as being called at the "initialization" phase
065         * @author cpw
066         *
067         */
068        @Retention(RetentionPolicy.RUNTIME)
069        @Target(ElementType.METHOD)
070        public @interface Init {}
071        /**
072         * Mark the designated method as being called at the "post-initialization" phase
073         * @author cpw
074         *
075         */
076        @Retention(RetentionPolicy.RUNTIME)
077        @Target(ElementType.METHOD)
078        public @interface PostInit {}
079        /**
080         * Mark the designated method as being called at the "server-starting" phase
081         * @author cpw
082         *
083         */
084        @Retention(RetentionPolicy.RUNTIME)
085        @Target(ElementType.METHOD)
086        public @interface ServerStarting {}
087        /**
088         * Mark the designated method as being called at the "post-initialization" phase
089         * @author cpw
090         *
091         */
092        @Retention(RetentionPolicy.RUNTIME)
093        @Target(ElementType.METHOD)
094        public @interface ServerStarted {}
095        /**
096         * Mark the designated method as being called at the "post-initialization" phase
097         * @author cpw
098         *
099         */
100        @Retention(RetentionPolicy.RUNTIME)
101        @Target(ElementType.METHOD)
102        public @interface ServerStopping {}
103        /**
104         * Populate the annotated field with the mod instance.
105         * @author cpw
106         *
107         */
108        @Retention(RetentionPolicy.RUNTIME)
109        @Target(ElementType.FIELD)
110        public @interface Instance {
111            /**
112             * The mod object to inject into this field
113             */
114            String value() default "";
115        }
116        /**
117         * Populate the annotated field with the mod's metadata.
118         * @author cpw
119         *
120         */
121        @Retention(RetentionPolicy.RUNTIME)
122        @Target(ElementType.FIELD)
123        public @interface Metadata {
124            /**
125             * The mod id specifying the metadata to load here
126             */
127            String value() default "";
128        }
129        /**
130         * Populate the annotated field with an instance of the Block as specified
131         * @author cpw
132         *
133         */
134        @Retention(RetentionPolicy.RUNTIME)
135        @Target(ElementType.FIELD)
136        public @interface Block {
137            /**
138             * The block's name
139             */
140            String name();
141            /**
142             * The associated ItemBlock subtype for the item (can be null for an ItemBlock)
143             */
144            Class<?> itemTypeClass() default ItemBlock.class;
145        }
146        /**
147         * Populate the annotated field with an Item
148         * @author cpw
149         *
150         */
151        @Retention(RetentionPolicy.RUNTIME)
152        @Target(ElementType.FIELD)
153        public @interface Item {
154            /**
155             * The name of the item
156             */
157            String name();
158            /**
159             * The type of the item
160             */
161            String typeClass();
162        }
163    }