diff options
author | dev@ftbsc <dev@fantabos.co> | 2023-02-06 22:48:00 +0100 |
---|---|---|
committer | dev@ftbsc <dev@fantabos.co> | 2023-02-06 22:48:00 +0100 |
commit | 3bf289bfb3a95c544805af7e883482988ae141a1 (patch) | |
tree | 5f5364e244f20fd9df5cdacfbed0bc4a91518065 /src/main | |
parent | aa54db5cefa47385484f4f837d6750f15fd2881a (diff) |
feat: added service interface
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/ftbsc/lll/IInjector.java | 57 |
1 files changed, 57 insertions, 0 deletions
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); +} + |