当前位置: 首页>>代码示例>>Java>>正文


Java MCVersion类代码示例

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


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

示例1: loadCoreMod

import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion; //导入依赖的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.MCVersion; //导入依赖的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.MCVersion类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。