mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-18 12:39:12 +00:00
Initial injection support, lots directly copy/pasted from LiteLoader
This commit is contained in:
1 parent
2124f4f1a0
commit
6c9cab6559
25 files changed
+3291
-6
No files matched your search
@@ -442,6 +442,19 @@ public class ASMHelper {
|
||||
return ASMHelper.getAnnotationValue(annotation, "value");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of an annotation node and do pseudo-duck-typing via Java's crappy generics
|
||||
*
|
||||
* @param annotation Annotation node to query
|
||||
* @param key Key to search for
|
||||
* @param defaultValue Value to return if the specified key is not found or is null
|
||||
* @return duck-typed annotation value, null if missing, or inevitable ClassCastException if your duck is actually a rooster
|
||||
*/
|
||||
public static <T> T getAnnotationValue(AnnotationNode annotation, String key, T defaultValue) {
|
||||
T returnValue = ASMHelper.getAnnotationValue(annotation, key);
|
||||
return returnValue != null ? returnValue : defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of an annotation node and do pseudo-duck-typing via Java's crappy generics
|
||||
*
|
||||
@@ -469,4 +482,12 @@ public class ASMHelper {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean methodIsStatic(MethodNode method) {
|
||||
return (method.access & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC;
|
||||
}
|
||||
|
||||
public static boolean fieldIsStatic(FieldNode field) {
|
||||
return (field.access & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user