    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.common.event;
    014
    015import com.google.common.base.Throwables;
    016
    017import cpw.mods.fml.common.Loader;
    018import cpw.mods.fml.common.LoaderState.ModState;
    019
    020public class FMLPostInitializationEvent extends FMLStateEvent
    021{
    022    public FMLPostInitializationEvent(Object... data)
    023    {
    024        super(data);
    025    }
    026
    027    @Override
    028    public ModState getModState()
    029    {
    030        return ModState.POSTINITIALIZED;
    031    }
    032
    033    public Object buildSoftDependProxy(String modId, String className)
    034    {
    035        if (Loader.isModLoaded(modId))
    036        {
    037            try
    038            {
    039                Class<?> clz = Class.forName(className,true,Loader.instance().getModClassLoader());
    040                return clz.newInstance();
    041            }
    042            catch (Exception e)
    043            {
    044                Throwables.propagateIfPossible(e);
    045                return null;
    046            }
    047        }
    048        return null;
    049    }
    050}