• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DependsOn类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中cpw.mods.fml.relauncher.IFMLLoadingPlugin.DependsOn的典型用法代码示例。如果您正苦于以下问题:Java DependsOn类的具体用法?Java DependsOn怎么用?Java DependsOn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DependsOn类属于cpw.mods.fml.relauncher.IFMLLoadingPlugin包,在下文中一共展示了DependsOn类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: loadCoreMod

import cpw.mods.fml.relauncher.IFMLLoadingPlugin.DependsOn; //导入依赖的package包/类
private static FMLPluginWrapper loadCoreMod(LaunchClassLoader classLoader, String coreModClass, File location)
{
    String coreModName = coreModClass.substring(coreModClass.lastIndexOf('.') + 1);
    try
    {
        FMLRelaunchLog.fine("Instantiating coremod class %s", coreModName);
        classLoader.addTransformerExclusion(coreModClass);
        Class<?> coreModClazz = Class.forName(coreModClass, true, classLoader);
        Name coreModNameAnn = coreModClazz.getAnnotation(IFMLLoadingPlugin.Name.class);
        if (coreModNameAnn != null && !Strings.isNullOrEmpty(coreModNameAnn.value()))
        {
            coreModName = coreModNameAnn.value();
            FMLRelaunchLog.finer("coremod named %s is loading", coreModName);
        }
        MCVersion requiredMCVersion = coreModClazz.getAnnotation(IFMLLoadingPlugin.MCVersion.class);
        if (!Arrays.asList(rootPlugins).contains(coreModClass) && (requiredMCVersion == null || Strings.isNullOrEmpty(requiredMCVersion.value())))
        {
            FMLRelaunchLog.log(Level.WARN, "The coremod %s does not have a MCVersion annotation, it may cause issues with this version of Minecraft",
                    coreModClass);
        }
        else if (requiredMCVersion != null && !FMLInjectionData.mccversion.equals(requiredMCVersion.value()))
        {
            FMLRelaunchLog.log(Level.ERROR, "The coremod %s is requesting minecraft version %s and minecraft is %s. It will be ignored.", coreModClass,
                    requiredMCVersion.value(), FMLInjectionData.mccversion);
            return null;
        }
        else if (requiredMCVersion != null)
        {
            FMLRelaunchLog.log(Level.DEBUG, "The coremod %s requested minecraft version %s and minecraft is %s. It will be loaded.", coreModClass,
                    requiredMCVersion.value(), FMLInjectionData.mccversion);
        }
        TransformerExclusions trExclusions = coreModClazz.getAnnotation(IFMLLoadingPlugin.TransformerExclusions.class);
        if (trExclusions != null)
        {
            for (String st : trExclusions.value())
            {
                classLoader.addTransformerExclusion(st);
            }
        }
        DependsOn deplist = coreModClazz.getAnnotation(IFMLLoadingPlugin.DependsOn.class);
        String[] dependencies = new String[0];
        if (deplist != null)
        {
            dependencies = deplist.value();
        }
        SortingIndex index = coreModClazz.getAnnotation(IFMLLoadingPlugin.SortingIndex.class);
        int sortIndex = index != null ? index.value() : 0;

        IFMLLoadingPlugin plugin = (IFMLLoadingPlugin) coreModClazz.newInstance();
        String accessTransformerClass = plugin.getAccessTransformerClass();
        if (accessTransformerClass != null)
        {
            FMLRelaunchLog.log(Level.DEBUG, "Added access transformer class %s to enqueued access transformers", accessTransformerClass);
            accessTransformers.add(accessTransformerClass);
        }
        FMLPluginWrapper wrap = new FMLPluginWrapper(coreModName, plugin, location, sortIndex, dependencies);
        loadPlugins.add(wrap);
        FMLRelaunchLog.fine("Enqueued coremod %s", coreModName);
        return wrap;
    }
    catch (ClassNotFoundException cnfe)
    {
        if (!Lists.newArrayList(rootPlugins).contains(coreModClass))
            FMLRelaunchLog.log(Level.ERROR, cnfe, "Coremod %s: Unable to class load the plugin %s", coreModName, coreModClass);
        else
            FMLRelaunchLog.fine("Skipping root plugin %s", coreModClass);
    }
    catch (ClassCastException cce)
    {
        FMLRelaunchLog.log(Level.ERROR, cce, "Coremod %s: The plugin %s is not an implementor of IFMLLoadingPlugin", coreModName, coreModClass);
    }
    catch (InstantiationException ie)
    {
        FMLRelaunchLog.log(Level.ERROR, ie, "Coremod %s: The plugin class %s was not instantiable", coreModName, coreModClass);
    }
    catch (IllegalAccessException iae)
    {
        FMLRelaunchLog.log(Level.ERROR, iae, "Coremod %s: The plugin class %s was not accessible", coreModName, coreModClass);
    }
    return null;
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:82,代码来源:CoreModManager.java


示例2: loadCoreMod

import cpw.mods.fml.relauncher.IFMLLoadingPlugin.DependsOn; //导入依赖的package包/类
private static FMLPluginWrapper loadCoreMod(LaunchClassLoader classLoader, String coreModClass, File location)
{
    String coreModName = coreModClass.substring(coreModClass.lastIndexOf('.') + 1);
    try
    {
        FMLRelaunchLog.fine("Instantiating coremod class %s", coreModName);
        classLoader.addTransformerExclusion(coreModClass);
        Class<?> coreModClazz = Class.forName(coreModClass, true, classLoader);
        Name coreModNameAnn = coreModClazz.getAnnotation(IFMLLoadingPlugin.Name.class);
        if (coreModNameAnn != null && !Strings.isNullOrEmpty(coreModNameAnn.value()))
        {
            coreModName = coreModNameAnn.value();
            FMLRelaunchLog.finest("coremod named %s is loading", coreModName);
        }
        MCVersion requiredMCVersion = coreModClazz.getAnnotation(IFMLLoadingPlugin.MCVersion.class);
        if (!Arrays.asList(rootPlugins).contains(coreModClass) && (requiredMCVersion == null || Strings.isNullOrEmpty(requiredMCVersion.value())))
        {
            FMLRelaunchLog.log(Level.WARNING, "The coremod %s does not have a MCVersion annotation, it may cause issues with this version of Minecraft",
                    coreModClass);
        }
        else if (requiredMCVersion != null && !FMLInjectionData.mccversion.equals(requiredMCVersion.value()))
        {
            FMLRelaunchLog.log(Level.SEVERE, "The coremod %s is requesting minecraft version %s and minecraft is %s. It will be ignored.", coreModClass,
                    requiredMCVersion.value(), FMLInjectionData.mccversion);
            return null;
        }
        else if (requiredMCVersion != null)
        {
            FMLRelaunchLog.log(Level.FINE, "The coremod %s requested minecraft version %s and minecraft is %s. It will be loaded.", coreModClass,
                    requiredMCVersion.value(), FMLInjectionData.mccversion);
        }
        TransformerExclusions trExclusions = coreModClazz.getAnnotation(IFMLLoadingPlugin.TransformerExclusions.class);
        if (trExclusions != null)
        {
            for (String st : trExclusions.value())
            {
                classLoader.addTransformerExclusion(st);
            }
        }
        DependsOn deplist = coreModClazz.getAnnotation(IFMLLoadingPlugin.DependsOn.class);
        String[] dependencies = new String[0];
        if (deplist != null)
        {
            dependencies = deplist.value();
        }
        SortingIndex index = coreModClazz.getAnnotation(IFMLLoadingPlugin.SortingIndex.class);
        int sortIndex = index != null ? index.value() : 0;

        IFMLLoadingPlugin plugin = (IFMLLoadingPlugin) coreModClazz.newInstance();
        FMLPluginWrapper wrap = new FMLPluginWrapper(coreModName, plugin, location, sortIndex, dependencies);
        loadPlugins.add(wrap);
        FMLRelaunchLog.fine("Enqueued coremod %s", coreModName);
        return wrap;
    }
    catch (ClassNotFoundException cnfe)
    {
        if (!Lists.newArrayList(rootPlugins).contains(coreModClass))
            FMLRelaunchLog.log(Level.SEVERE, cnfe, "Coremod %s: Unable to class load the plugin %s", coreModName, coreModClass);
        else
            FMLRelaunchLog.fine("Skipping root plugin %s", coreModClass);
    }
    catch (ClassCastException cce)
    {
        FMLRelaunchLog.log(Level.SEVERE, cce, "Coremod %s: The plugin %s is not an implementor of IFMLLoadingPlugin", coreModName, coreModClass);
    }
    catch (InstantiationException ie)
    {
        FMLRelaunchLog.log(Level.SEVERE, ie, "Coremod %s: The plugin class %s was not instantiable", coreModName, coreModClass);
    }
    catch (IllegalAccessException iae)
    {
        FMLRelaunchLog.log(Level.SEVERE, iae, "Coremod %s: The plugin class %s was not accessible", coreModName, coreModClass);
    }
    return null;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:76,代码来源:CoreModManager.java



注:本文中的cpw.mods.fml.relauncher.IFMLLoadingPlugin.DependsOn类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PartitionAware类代码示例发布时间:2022-05-23
下一篇:
Java LargeObjectManager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap