Java 类cpw.mods.fml.common.discovery.ASMDataTable 实例源码

项目:Dimensional-Pockets    文件:ConfigContainer.java   
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);
            }
        }
    }
}
项目:OmnisCore    文件:ConfigContainer.java   
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);
            }
        }
    }
}
项目:TRHS_Club_Mod_2016    文件:ModClassLoader.java   
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;
}
项目:TRHS_Club_Mod_2016    文件:ASMModParser.java   
public void sendToTable(ASMDataTable table, ModCandidate candidate)
{
    for (ModAnnotation ma : annotations)
    {
        table.addASMData(candidate, ma.asmType.getClassName(), this.asmType.getClassName(), ma.member, ma.values);
    }
}
项目:TRHS_Club_Mod_2016    文件:FMLConstructionEvent.java   
@SuppressWarnings("unchecked")
public FMLConstructionEvent(Object... eventData)
{
    this.modClassLoader = (ModClassLoader)eventData[0];
    this.asmData = (ASMDataTable) eventData[1];
    this.reverseDependencies = (ListMultimap<String, String>) eventData[2];
}
项目:TRHS_Club_Mod_2016    文件:ModAPITransformer.java   
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);
}
项目:LambdaLib    文件:LLModContainer.java   
@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);
}
项目:CauldronGit    文件:ModClassLoader.java   
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;
}
项目:CauldronGit    文件:ASMModParser.java   
public void sendToTable(ASMDataTable table, ModCandidate candidate)
{
    for (ModAnnotation ma : annotations)
    {
        table.addASMData(candidate, ma.asmType.getClassName(), this.asmType.getClassName(), ma.member, ma.values);
    }
}
项目:CauldronGit    文件:FMLConstructionEvent.java   
@SuppressWarnings("unchecked")
public FMLConstructionEvent(Object... eventData)
{
    this.modClassLoader = (ModClassLoader)eventData[0];
    this.asmData = (ASMDataTable) eventData[1];
    this.reverseDependencies = (ListMultimap<String, String>) eventData[2];
}
项目:CauldronGit    文件:ModAPITransformer.java   
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);
}
项目:Dimensional-Pockets    文件:ConfigHandler.java   
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;
}
项目:Cauldron    文件:ModClassLoader.java   
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;
}
项目:Cauldron    文件:ASMModParser.java   
public void sendToTable(ASMDataTable table, ModCandidate candidate)
{
    for (ModAnnotation ma : annotations)
    {
        table.addASMData(candidate, ma.asmType.getClassName(), this.asmType.getClassName(), ma.member, ma.values);
    }
}
项目:Cauldron    文件:FMLConstructionEvent.java   
@SuppressWarnings("unchecked")
public FMLConstructionEvent(Object... eventData)
{
    this.modClassLoader = (ModClassLoader)eventData[0];
    this.asmData = (ASMDataTable) eventData[1];
    this.reverseDependencies = (ListMultimap<String, String>) eventData[2];
}
项目:Cauldron    文件:ModAPITransformer.java   
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);
}
项目:Cauldron    文件:ModClassLoader.java   
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;
}
项目:Cauldron    文件:ASMModParser.java   
public void sendToTable(ASMDataTable table, ModCandidate candidate)
{
    for (ModAnnotation ma : annotations)
    {
        table.addASMData(candidate, ma.asmType.getClassName(), this.asmType.getClassName(), ma.member, ma.values);
    }
}
项目:Cauldron    文件:FMLConstructionEvent.java   
@SuppressWarnings("unchecked")
public FMLConstructionEvent(Object... eventData)
{
    this.modClassLoader = (ModClassLoader)eventData[0];
    this.asmData = (ASMDataTable) eventData[1];
    this.reverseDependencies = (ListMultimap<String, String>) eventData[2];
}
项目:Cauldron    文件:ModAPITransformer.java   
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);
}
项目:Cauldron    文件:ModClassLoader.java   
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;
}
项目:Cauldron    文件:ASMModParser.java   
public void sendToTable(ASMDataTable table, ModCandidate candidate)
{
    for (ModAnnotation ma : annotations)
    {
        table.addASMData(candidate, ma.asmType.getClassName(), this.asmType.getClassName(), ma.member, ma.values);
    }
}
项目:Cauldron    文件:FMLConstructionEvent.java   
@SuppressWarnings("unchecked")
public FMLConstructionEvent(Object... eventData)
{
    this.modClassLoader = (ModClassLoader)eventData[0];
    this.asmData = (ASMDataTable) eventData[1];
    this.reverseDependencies = (ListMultimap<String, String>) eventData[2];
}
项目:Cauldron    文件:ModAPITransformer.java   
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);
}
项目:RuneCraftery    文件:NetworkModHandler.java   
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);
}
项目:RuneCraftery    文件:FMLNetworkHandler.java   
public boolean registerNetworkMod(ModContainer container, Class<?> networkModClass, ASMDataTable asmData)
{
    NetworkModHandler handler = new NetworkModHandler(container, networkModClass, asmData);
    if (handler.isNetworkMod())
    {
        registerNetworkMod(handler);
    }

    return handler.isNetworkMod();
}
项目:RuneCraftery    文件:ModClassLoader.java   
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;
}
项目:RuneCraftery    文件:ASMModParser.java   
public void sendToTable(ASMDataTable table, ModCandidate candidate)
{
    for (ModAnnotation ma : annotations)
    {
        table.addASMData(candidate, ma.asmType.getClassName(), this.asmType.getClassName(), ma.member, ma.values);
    }
}
项目:RuneCraftery    文件:ModAPITransformer.java   
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);
}
项目:RuneCraftery    文件:NetworkModHandler.java   
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);
}
项目:RuneCraftery    文件:FMLNetworkHandler.java   
public boolean registerNetworkMod(ModContainer container, Class<?> networkModClass, ASMDataTable asmData)
{
    NetworkModHandler handler = new NetworkModHandler(container, networkModClass, asmData);
    if (handler.isNetworkMod())
    {
        registerNetworkMod(handler);
    }

    return handler.isNetworkMod();
}
项目:RuneCraftery    文件:ModClassLoader.java   
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;
}
项目:RuneCraftery    文件:ASMModParser.java   
public void sendToTable(ASMDataTable table, ModCandidate candidate)
{
    for (ModAnnotation ma : annotations)
    {
        table.addASMData(candidate, ma.asmType.getClassName(), this.asmType.getClassName(), ma.member, ma.values);
    }
}
项目:RuneCraftery    文件:ModAPITransformer.java   
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);
}
项目:OmnisCore    文件:ConfigHandler.java   
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;
}
项目:BetterNutritionMod    文件:NetworkModHandler.java   
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);
}
项目:BetterNutritionMod    文件:FMLNetworkHandler.java   
public boolean registerNetworkMod(ModContainer container, Class<?> networkModClass, ASMDataTable asmData)
{
    NetworkModHandler handler = new NetworkModHandler(container, networkModClass, asmData);
    if (handler.isNetworkMod())
    {
        registerNetworkMod(handler);
    }

    return handler.isNetworkMod();
}
项目:BetterNutritionMod    文件:ModClassLoader.java   
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;
}
项目:BetterNutritionMod    文件:ASMModParser.java   
public void sendToTable(ASMDataTable table, ModCandidate candidate)
{
    for (ModAnnotation ma : annotations)
    {
        table.addASMData(candidate, ma.asmType.getClassName(), this.asmType.getClassName(), ma.member, ma.values);
    }
}
项目:BetterNutritionMod    文件:ModAPITransformer.java   
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);
}