summaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc/lll/IInjector.java
blob: d0c28f04d5d70aa7eff30f2fb90b5bd64f871fdb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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);
}