本文整理匯總了Java中cpw.mods.fml.relauncher.ReflectionHelper.getClass方法的典型用法代碼示例。如果您正苦於以下問題:Java ReflectionHelper.getClass方法的具體用法?Java ReflectionHelper.getClass怎麽用?Java ReflectionHelper.getClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cpw.mods.fml.relauncher.ReflectionHelper
的用法示例。
在下文中一共展示了ReflectionHelper.getClass方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getAppEngApi
import cpw.mods.fml.relauncher.ReflectionHelper; //導入方法依賴的package包/類
/**
* All future API calls should be made via this method.
* @return
*/
public static IAppEngApi getAppEngApi()
{
try {
Class c = ReflectionHelper.getClass( Util.class.getClassLoader(), "appeng.common.AppEngApi" );
api = (IAppEngApi) c.getMethod( "getInstance" ).invoke( c );
} catch ( Throwable e) {
return null;
}
return api;
}
示例2: initialize
import cpw.mods.fml.relauncher.ReflectionHelper; //導入方法依賴的package包/類
/**
* Initializes the AestusCraft API.
*
* Only AestusCraft should call this method.
*/
public static void initialize()
{
if (m_Initialized)
{
return;
}
AestusCraftAPI.log = Logger.getLogger("AestusCraft-API");
AestusCraftAPI.log.setParent(FMLLog.getLogger());
Class<?> registryClass = ReflectionHelper.getClass(AestusCraftAPI.class.getClassLoader(), "dk.kiljacken.aestuscraft.core.Registry");
try
{
Object nil = null;
m_BlockMap = ReflectionUtil.getPrivateValue(registryClass, nil, "m_BlockMap");
m_ItemMap = ReflectionUtil.getPrivateValue(registryClass, nil, "m_ItemMap");
m_Initialized = true;
}
catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e)
{
AestusCraftAPI.log.severe("Exception while initializing AestusCraft API");
AestusCraftAPI.log.severe("Parent mod: " + Loader.instance().activeModContainer().getName());
throw new RuntimeException(e);
}
}