Adding Oak's graphic change transformer (#146)

This commit is contained in:
Ganom
2019-04-28 22:00:19 -04:00
committed by vanni
parent 1af505ed47
commit 1f220ff146

View File

@@ -15,6 +15,7 @@ public class ActorTransform implements Transform {
ct = ByteCodePatcher.classPool.get(actor.getName());
transformGetAnimation();
transformAnimationChanged();
transformGraphicChanged();
ByteCodePatcher.modifiedClasses.add(ct);
} catch (NotFoundException e) {
e.printStackTrace();
@@ -54,4 +55,18 @@ public class ActorTransform implements Transform {
}
}
public void transformGraphicChanged() {
try {
CtMethod graphicChanged = ct.getDeclaredMethod("graphicChanged", new CtClass[]{CtClass.intType});
ct.removeMethod(graphicChanged);
graphicChanged = CtNewMethod.make("public void graphicChanged(int paramInt){" +
" net.runelite.api.events.GraphicChanged localGraphicChanged = new net.runelite.api.events.GraphicChanged();" +
" localGraphicChanged.setActor(this);" +
" "+ByteCodePatcher.clientInstance+".getCallbacks().post(localGraphicChanged);}",ct);
ct.addMethod(graphicChanged);
} catch (Exception e) {
e.printStackTrace();
}
}
}