Search in sources :

Example 1 with Construct

use of net.runelite.mapping.Construct in project runelite by runelite.

the class InjectConstruct method inject.

public void inject(Map<ClassFile, java.lang.Class> implemented) throws InjectionException {
    for (Entry<ClassFile, java.lang.Class> entry : implemented.entrySet()) {
        Class<?> clazz = entry.getValue();
        ClassFile cf = entry.getKey();
        if (clazz == null) {
            continue;
        }
        for (java.lang.reflect.Method method : clazz.getDeclaredMethods()) {
            if (method.isSynthetic()) {
                continue;
            }
            Construct construct = method.getAnnotation(Construct.class);
            if (construct == null) {
                continue;
            }
            String obfuscatedName = DeobAnnotations.getObfuscatedName(cf.getAnnotations());
            if (obfuscatedName == null) {
                obfuscatedName = cf.getName();
            }
            ClassGroup vanilla = inject.getVanilla();
            ClassFile other = vanilla.findClass(obfuscatedName);
            assert other != null : "unable to find vanilla class from obfuscated name: " + obfuscatedName;
            injectConstruct(other, method);
        }
    }
}
Also used : ClassFile(net.runelite.asm.ClassFile) ClassGroup(net.runelite.asm.ClassGroup) Construct(net.runelite.mapping.Construct)

Aggregations

ClassFile (net.runelite.asm.ClassFile)1 ClassGroup (net.runelite.asm.ClassGroup)1 Construct (net.runelite.mapping.Construct)1