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


Java ASMDataTable类代码示例

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


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

示例1: processAllClasses

import cpw.mods.fml.common.discovery.ASMDataTable; //导入依赖的package包/类
public void processAllClasses(ASMDataTable dataTable, Map<Class<? extends Annotation>, Class<? extends ConfigEntry<? extends Annotation, ?>>> staticMap) {
    for (Map.Entry<Class<? extends Annotation>, Class<? extends ConfigEntry<? extends Annotation, ?>>> entry : staticMap.entrySet()) {
        try {
            annotationMap.put(entry.getKey(), entry.getValue().newInstance().setConfig(config));
        } catch (InstantiationException | IllegalAccessException e) {
            DPLogger.severe("Failed to create instance of the registered ConfigEntry!", e);
        }
    }

    ArrayList<String> processedClasses = new ArrayList<>();
    for (Class<? extends Annotation> clazz : annotationMap.keySet()) {
        for (ASMData asmData : dataTable.getAll(clazz.getName())) {
            String className = asmData.getClassName();
            if (childClasses.contains(className) && !processedClasses.contains(className)) {
                processedClasses.add(className);
                processClass(className);
            }
        }
    }
}
 
开发者ID:NPException,项目名称:Dimensional-Pockets,代码行数:21,代码来源:ConfigContainer.java

示例2: processAllClasses

import cpw.mods.fml.common.discovery.ASMDataTable; //导入依赖的package包/类
public void processAllClasses(ASMDataTable dataTable, Map<Class<? extends Annotation>, Class<? extends ConfigEntry<? extends Annotation, ?>>> staticMap) {
    for (Map.Entry<Class<? extends Annotation>, Class<? extends ConfigEntry<? extends Annotation, ?>>> entry : staticMap.entrySet()) {
        try {
            annotationMap.put(entry.getKey(), entry.getValue().newInstance().setConfig(config));
        } catch (InstantiationException | IllegalAccessException e) {
            CoreProperties.logger.fatal("Failed to create instance of the registered ConfigEntry!", e);
        }
    }

    ArrayList<String> processedClasses = new ArrayList<>();
    for (Class<? extends Annotation> clazz : annotationMap.keySet()) {
        for (ASMData asmData : dataTable.getAll(clazz.getName())) {
            String className = asmData.getClassName();
            if (childClasses.contains(className) && !processedClasses.contains(className)) {
                processedClasses.add(className);
                processClass(className);
            }
        }
    }
}
 
开发者ID:Jezza,项目名称:OmnisCore,代码行数:21,代码来源:ConfigContainer.java

示例3: addModAPITransformer

import cpw.mods.fml.common.discovery.ASMDataTable; //导入依赖的package包/类
public ModAPITransformer addModAPITransformer(ASMDataTable dataTable)
{
    mainClassLoader.registerTransformer("cpw.mods.fml.common.asm.transformers.ModAPITransformer");
    List<IClassTransformer> transformers = mainClassLoader.getTransformers();
    ModAPITransformer modAPI = (ModAPITransformer) transformers.get(transformers.size()-1);
    modAPI.initTable(dataTable);
    return modAPI;
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:9,代码来源:ModClassLoader.java

示例4: sendToTable

import cpw.mods.fml.common.discovery.ASMDataTable; //导入依赖的package包/类
public void sendToTable(ASMDataTable table, ModCandidate candidate)
{
    for (ModAnnotation ma : annotations)
    {
        table.addASMData(candidate, ma.asmType.getClassName(), this.asmType.getClassName(), ma.member, ma.values);
    }
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:8,代码来源:ASMModParser.java

示例5: FMLConstructionEvent

import cpw.mods.fml.common.discovery.ASMDataTable; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public FMLConstructionEvent(Object... eventData)
{
    this.modClassLoader = (ModClassLoader)eventData[0];
    this.asmData = (ASMDataTable) eventData[1];
    this.reverseDependencies = (ListMultimap<String, String>) eventData[2];
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:8,代码来源:FMLConstructionEvent.java

示例6: initTable

import cpw.mods.fml.common.discovery.ASMDataTable; //导入依赖的package包/类
public void initTable(ASMDataTable dataTable)
{
    optionals = ArrayListMultimap.create();
    Set<ASMData> interfaceLists = dataTable.getAll("cpw.mods.fml.common.Optional$InterfaceList");
    addData(unpackInterfaces(interfaceLists));
    Set<ASMData> interfaces = dataTable.getAll("cpw.mods.fml.common.Optional$Interface");
    addData(interfaces);
    Set<ASMData> methods = dataTable.getAll("cpw.mods.fml.common.Optional$Method");
    addData(methods);
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:11,代码来源:ModAPITransformer.java

示例7: constructMod

import cpw.mods.fml.common.discovery.ASMDataTable; //导入依赖的package包/类
@Subscribe
public void constructMod(FMLConstructionEvent event) {
    log.info("LambdaLib|Core is loading.");

    // Get annotation information from forge asm data table.
    // This must be done before PreInit stage.
    ASMDataTable data = event.getASMHarvestedData();

    Set<String> removedClasses = Sets.newHashSet();
    { // Get removed classes
        String startupSide = FMLCommonHandler.instance().getSide().toString();
        Set<ASMData> sideData = data.getAll("cpw.mods.fml.relauncher.SideOnly");
        for (ASMData ad : sideData) if (ad.getClassName().equals(ad.getObjectName())) { // If is a class
            EnumHolder enumHolder = (EnumHolder) ad.getAnnotationInfo().get("value");
            try {
                String value = (String) ehFieldValue.get(enumHolder);
                if (!value.equals(startupSide)) {
                    removedClasses.add(ad.getClassName());
                }
            } catch (IllegalAccessException ex) {
                throw Throwables.propagate(ex);
            }
        }
    }

    LLModContainer.removedClasses.addAll(removedClasses);

    Set<String> registrants = mapToClass(data.getAll("cn.lambdalib.annoreg.core.Registrant"));
    registrants.removeAll(removedClasses);
    RegistrationManager.INSTANCE.annotationList(registrants);

    Set<String> registryTypes = mapToClass(data.getAll("cn.lambdalib.annoreg.core.RegistryTypeDecl"));
    registryTypes.removeAll(removedClasses);
    RegistrationManager.INSTANCE.addRegistryTypes(registryTypes);

    Set<String> registryMods = mapToClass(data.getAll("cn.lambdalib.annoreg.core.RegistrationMod"));
    registryMods.removeAll(removedClasses);
    RegistrationManager.INSTANCE.addAnnotationMod(registryMods);
}
 
开发者ID:LambdaInnovation,项目名称:LambdaLib,代码行数:40,代码来源:LLModContainer.java

示例8: parseControllers

import cpw.mods.fml.common.discovery.ASMDataTable; //导入依赖的package包/类
public void parseControllers(FMLPreInitializationEvent event) {
    if (init)
        return;
    init = true;

    ASMDataTable asmDataTable = event.getAsmData();
    Set<ASMData> asmDataSet = asmDataTable.getAll(Controller.class.getName());

    // Filters out all controller annotations and places them with their associated mod.
    for (ASMData data : asmDataSet) {
        ModCandidate candidate = data.getCandidate();
        for (ModContainer modContainer : candidate.getContainedMods()) {
            String modId = modContainer.getModId();
            if (!configMap.containsKey(modId))
                configMap.put(modId, new ConfigData(modContainer, candidate.getClassList()));
            configMap.get(modId).addRoot(data);
        }
    }

    // Process all potential registrars first.
    for (ConfigData configValue : configMap.values())
        if (configValue.isRegistrar)
            configValue.processIConfigRegistrar(this);
    processed = true;

    for (ConfigData configData : configMap.values()) {
        // Organise all sub-packages.
        configData.processRoots();

        // Process all current classes associated with the ConfigContainer.
        configData.processConfigContainers(asmDataTable, annotationMap);
    }
    postProcessed = true;
}
 
开发者ID:NPException,项目名称:Dimensional-Pockets,代码行数:35,代码来源:ConfigHandler.java

示例9: NetworkModHandler

import cpw.mods.fml.common.discovery.ASMDataTable; //导入依赖的package包/类
public NetworkModHandler(ModContainer container, Class<?> networkModClass, ASMDataTable table)
{
    this(container, networkModClass.getAnnotation(NetworkMod.class));
    if (this.mod == null)
    {
        return;
    }

    Set<ASMData> versionCheckHandlers = table.getAnnotationsFor(container).get(NetworkMod.VersionCheckHandler.class.getName());
    String versionCheckHandlerMethod = null;
    for (ASMData vch : versionCheckHandlers)
    {
        if (vch.getClassName().equals(networkModClass.getName()))
        {
            versionCheckHandlerMethod = vch.getObjectName();
            versionCheckHandlerMethod = versionCheckHandlerMethod.substring(0,versionCheckHandlerMethod.indexOf('('));
            break;
        }
    }
    if (versionCheckHandlerMethod != null)
    {
        try
        {
            Method checkHandlerMethod = networkModClass.getDeclaredMethod(versionCheckHandlerMethod, String.class);
            if (checkHandlerMethod.isAnnotationPresent(NetworkMod.VersionCheckHandler.class))
            {
                this.checkHandler = checkHandlerMethod;
            }
        }
        catch (Exception e)
        {
            FMLLog.log(Level.WARNING, e, "The declared version check handler method %s on network mod id %s is not accessible", versionCheckHandlerMethod, container.getModId());
        }
    }

    configureNetworkMod(container);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:38,代码来源:NetworkModHandler.java

示例10: registerNetworkMod

import cpw.mods.fml.common.discovery.ASMDataTable; //导入依赖的package包/类
public boolean registerNetworkMod(ModContainer container, Class<?> networkModClass, ASMDataTable asmData)
{
    NetworkModHandler handler = new NetworkModHandler(container, networkModClass, asmData);
    if (handler.isNetworkMod())
    {
        registerNetworkMod(handler);
    }

    return handler.isNetworkMod();
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:11,代码来源:FMLNetworkHandler.java


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