From 3bf289bfb3a95c544805af7e883482988ae141a1 Mon Sep 17 00:00:00 2001 From: "dev@ftbsc" Date: Mon, 6 Feb 2023 22:48:00 +0100 Subject: feat: added service interface --- src/main/java/ftbsc/lll/IInjector.java | 57 ++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/main/java/ftbsc/lll/IInjector.java diff --git a/src/main/java/ftbsc/lll/IInjector.java b/src/main/java/ftbsc/lll/IInjector.java new file mode 100644 index 0000000..d0c28f0 --- /dev/null +++ b/src/main/java/ftbsc/lll/IInjector.java @@ -0,0 +1,57 @@ +package ftbsc.lll; + +import org.objectweb.asm.tree.ClassNode; +import org.objectweb.asm.tree.MethodNode; + +public interface IInjector { + + /** + * @return name of injector, for logging + */ + String name(); + + /** + * @return reason for patching for this injector, for loggin + */ + default String reason() { return ""; } + + /** + * This is used by the Launch Plugin to identify which classes should be + * altered, and on which classes this injector should operate. + * + * Class name should be dot-separated, for example "net.minecraft.client.Minecraft" + * + * @return target class to operate onto + */ + String targetClass(); + + /** + * This is used by the Launch Plugin to identify which methods to provide + * to this injector for patching. It should return the Searge name of wanted function. + * example: "func_71407_l", which is "tick()" on "Minecraft" class in 1.16.5 + * + * @return target method name to operate onto + */ + String methodName(); + + /** + * This is used by the Launch Plugin to identify which methods to provide + * to this injector for patching. It should return the method descriptor, with + * parameters and return types. example: "()V" for void parameters and return. + * + * TODO better example... + * + * @return target method name to operate onto + */ + String methodDesc(); + + /** + * Once the Launch Plugin has identified classes and methods for injectors, + * this method will be called providing the correct class and method nodes for patching. + * + * @param clazz class node which is being patched + * @param method main method node of requested function for patching + */ + void inject(ClassNode clazz, MethodNode method); +} + -- cgit v1.2.3-56-ga3b1