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.relauncher;
014
015import java.lang.annotation.ElementType;
016import java.lang.annotation.Retention;
017import java.lang.annotation.RetentionPolicy;
018import java.lang.annotation.Target;
019import java.util.Map;
020
021/**
022 * The base plugin that provides class name meta information to FML to
023 * enhance the classloading lifecycle for mods in FML
024 *
025 * @author cpw
026 *
027 */
028public interface IFMLLoadingPlugin
029{
030    /**
031     * Return a list of classes that implement the ILibrarySet interface
032     *
033     * @return a list of classes that implement the ILibrarySet interface
034     */
035    String[] getLibraryRequestClass();
036    /**
037     * Return a list of classes that implements the IClassTransformer interface
038     * @return a list of classes that implements the IClassTransformer interface
039     */
040    String[] getASMTransformerClass();
041
042    /**
043     * Return a class name that implements "ModContainer" for injection into the mod list
044     * The "getName" function should return a name that other mods can, if need be,
045     * depend on.
046     * Trivially, this modcontainer will be loaded before all regular mod containers,
047     * which means it will be forced to be "immutable" - not susceptible to normal
048     * sorting behaviour.
049     * All other mod behaviours are available however- this container can receive and handle
050     * normal loading events
051     */
052    String getModContainerClass();
053
054    /**
055     * Return the class name of an implementor of "IFMLCallHook", that will be run, in the
056     * main thread, to perform any additional setup this coremod may require. It will be
057     * run <strong>prior</strong> to Minecraft starting, so it CANNOT operate on minecraft
058     * itself. The game will deliberately crash if this code is detected to trigger a
059     * minecraft class loading (TODO: implement crash ;) )
060     */
061    String getSetupClass();
062
063    /**
064     * Inject coremod data into this coremod
065     * This data includes:
066     * "mcLocation" : the location of the minecraft directory,
067     * "coremodList" : the list of coremods
068     * "coremodLocation" : the file this coremod loaded from,
069     */
070    void injectData(Map<String, Object> data);
071
072
073    /**
074     * Annotate your load plugin with a list of package prefixes that will *not* be
075     * processed by the ASM transformation stack.
076     *
077     * Your plugin, and any transformers should *definitely* be in this list, because
078     * otherwise you can face problems with the classloader trying to transform classes
079     * with your transformer, whilst it is *loading* your transformer. Not pretty.
080     *
081     * @author cpw
082     *
083     */
084    @Retention(RetentionPolicy.RUNTIME)
085    @Target(ElementType.TYPE)
086    public @interface TransformerExclusions
087    {
088        public String[] value() default "";
089    }
090}