Transform objects now use an interface
This commit is contained in:
@@ -1,22 +1,15 @@
|
||||
package net.runelite.client.rs.bytecode.transformers;
|
||||
|
||||
import javassist.CannotCompileException;
|
||||
import javassist.CtClass;
|
||||
import javassist.CtMethod;
|
||||
import javassist.CtNewMethod;
|
||||
import javassist.NotFoundException;
|
||||
import net.runelite.client.rs.bytecode.ByteCodePatcher;
|
||||
import net.runelite.client.rs.bytecode.ByteCodeUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
|
||||
public class ActorTransform {
|
||||
public class ActorTransform implements Transform {
|
||||
public CtClass ct = null;
|
||||
|
||||
|
||||
@Override
|
||||
public void modify(Class actor) {
|
||||
try {
|
||||
ct = ByteCodePatcher.classPool.get(actor.getName());
|
||||
@@ -28,6 +21,9 @@ public class ActorTransform {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform() { }
|
||||
|
||||
public void transformGetAnimation() {
|
||||
try {
|
||||
CtMethod protectedAnimation = ct.getDeclaredMethod("1protect$getRsAnimation");
|
||||
|
||||
@@ -5,9 +5,10 @@ import javassist.CtMethod;
|
||||
import javassist.CtNewMethod;
|
||||
import net.runelite.client.rs.bytecode.ByteCodePatcher;
|
||||
|
||||
public class PlayerTransform {
|
||||
public class PlayerTransform implements Transform {
|
||||
public CtClass ct = null;
|
||||
|
||||
@Override
|
||||
public void modify(Class player) {
|
||||
try {
|
||||
ct = ByteCodePatcher.classPool.get(player.getName());
|
||||
@@ -19,6 +20,9 @@ public class PlayerTransform {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(){}
|
||||
|
||||
public void transformProtectedGetSkullIcon() {
|
||||
CtMethod protectedGetSkullIcon;
|
||||
try {
|
||||
|
||||
@@ -4,22 +4,23 @@ import javassist.CtClass;
|
||||
import javassist.CtMethod;
|
||||
import javassist.CtNewMethod;
|
||||
import net.runelite.client.rs.bytecode.ByteCodePatcher;
|
||||
import net.runelite.client.rs.bytecode.ByteCodeUtils;
|
||||
|
||||
public class ProjectileTransform {
|
||||
public class ProjectileTransform implements Transform {
|
||||
public CtClass ct = null;
|
||||
|
||||
@Override
|
||||
public void modify(Class projectile) {
|
||||
try {
|
||||
ct = ByteCodePatcher.classPool.get(projectile.getName());
|
||||
transformProjectileMoved();
|
||||
transform();
|
||||
ByteCodePatcher.modifiedClasses.add(ct);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void transformProjectileMoved() {
|
||||
@Override
|
||||
public void transform() {
|
||||
CtMethod getAnimation;
|
||||
try {
|
||||
getAnimation = ct.getDeclaredMethod("projectileMoved", new CtClass[]{CtClass.intType, CtClass.intType, CtClass.intType, CtClass.intType});
|
||||
@@ -37,4 +38,5 @@ public class ProjectileTransform {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package net.runelite.client.rs.bytecode.transformers;
|
||||
|
||||
public interface Transform {
|
||||
|
||||
void modify(Class clazz);
|
||||
void transform();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user