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         * @return
036         */
037        String modid();
038        /**
039         * A user friendly name for the mod
040         * @return
041         */
042        String name() default "";
043        /**
044         * A version string for this mod
045         * @return
046         */
047        String version() default "";
048        /**
049         * A simple dependency string for this mod (see modloader's "priorities" string specification)
050         * @return
051         */
052        String dependencies() default "";
053        /**
054         * Whether to use the mcmod.info metadata by default for this mod.
055         * If true, settings in the mcmod.info file will override settings in these annotations.
056         * @return
057         */
058        boolean useMetadata() default false;
059    
060        /**
061         * Mark the designated method as being called at the "pre-initialization" phase
062         * @author cpw
063         *
064         */
065        @Retention(RetentionPolicy.RUNTIME)
066        @Target(ElementType.METHOD)
067        public @interface PreInit {}
068        /**
069         * Mark the designated method as being called at the "initialization" phase
070         * @author cpw
071         *
072         */
073        @Retention(RetentionPolicy.RUNTIME)
074        @Target(ElementType.METHOD)
075        public @interface Init {}
076        /**
077         * Mark the designated method as being called at the "post-initialization" phase
078         * @author cpw
079         *
080         */
081        @Retention(RetentionPolicy.RUNTIME)
082        @Target(ElementType.METHOD)
083        public @interface PostInit {}
084        /**
085         * Mark the designated method as being called at the "server-starting" phase
086         * @author cpw
087         *
088         */
089        @Retention(RetentionPolicy.RUNTIME)
090        @Target(ElementType.METHOD)
091        public @interface ServerStarting {}
092        /**
093         * Mark the designated method as being called at the "post-initialization" phase
094         * @author cpw
095         *
096         */
097        @Retention(RetentionPolicy.RUNTIME)
098        @Target(ElementType.METHOD)
099        public @interface ServerStarted {}
100        /**
101         * Mark the designated method as being called at the "post-initialization" phase
102         * @author cpw
103         *
104         */
105        @Retention(RetentionPolicy.RUNTIME)
106        @Target(ElementType.METHOD)
107        public @interface ServerStopping {}
108        /**
109         * Populate the annotated field with the mod instance.
110         * @author cpw
111         *
112         */
113        @Retention(RetentionPolicy.RUNTIME)
114        @Target(ElementType.FIELD)
115        public @interface Instance {
116            /**
117             * The mod object to inject into this field
118             * @return
119             */
120            String value() default "";
121        }
122        /**
123         * Populate the annotated field with the mod's metadata.
124         * @author cpw
125         *
126         */
127        @Retention(RetentionPolicy.RUNTIME)
128        @Target(ElementType.FIELD)
129        public @interface Metadata {
130            /**
131             * The mod id specifying the metadata to load here
132             * @return
133             */
134            String value() default "";
135        }
136        /**
137         * Populate the annotated field with an instance of the Block as specified
138         * @author cpw
139         *
140         */
141        @Retention(RetentionPolicy.RUNTIME)
142        @Target(ElementType.FIELD)
143        public @interface Block {
144            /**
145             * The block's name
146             * @return
147             */
148            String name();
149            /**
150             * The associated ItemBlock subtype for the item (can be null for an ItemBlock)
151             * @return
152             */
153            Class<?> itemTypeClass() default ItemBlock.class;
154        }
155        /**
156         * Populate the annotated field with an Item
157         * @author cpw
158         *
159         */
160        @Retention(RetentionPolicy.RUNTIME)
161        @Target(ElementType.FIELD)
162        public @interface Item {
163            /**
164             * The name of the item
165             * @return
166             */
167            String name();
168            /**
169             * The type of the item
170             * @return
171             */
172            String typeClass();
173        }
174    }