本文整理汇总了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);
}
}
}
}
示例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);
}
}
}
}
示例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;
}
示例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);
}
}
示例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];
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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();
}