Package ftbsc.lll
Interface IInjector
public interface IInjector
Patch classes should implement this interface and be declared as services in
the META-INF/services folder (or through modules in Java 9+, but only Java 8
is officially supported).
-
Method Summary
Modifier and TypeMethodDescriptionvoidinject(org.objectweb.asm.tree.ClassNode clazz, org.objectweb.asm.tree.MethodNode method) This method is to be called by the launcher after identifying the right class and method to patch.This should return the target method's descriptor.This is used to identify the method to transform within the class.name()default Stringreason()This is used to identify which classes should be altered, and on which class should this injector operate.
-
Method Details
-
name
String name()- Returns:
- name of injector, for logging
-
reason
- Returns:
- reason for this patch, for logging
-
targetClass
String targetClass()This is used to identify which classes should be altered, and on which class should this injector operate. Class name should be dot-separated, for example "net.minecraft.client.Minecraft".- Returns:
- class to transform
-
methodName
String methodName()This is used to identify the method to transform within the class. It should return the name of target.- Returns:
- method to transform
-
methodDesc
String methodDesc()This should return the target method's descriptor. Methods in Java may have the same name but different parameters: a descriptor compiles that information, as well as the return type, in as little space as possible. Examples:- (IF)V - returns void, takes in int and float
- (Ljava/lang/Object;)I - returns int, takes in a java.lang.Object
- (ILjava/lang/String;)[I - returns int[], takes in an int and a String
- Returns:
- descriptor of method to target.
-
inject
void inject(org.objectweb.asm.tree.ClassNode clazz, org.objectweb.asm.tree.MethodNode method) This method is to be called by the launcher after identifying the right class and method to patch. The overriding method should contain the actual patching logic.- Parameters:
clazz- theClassNodecurrently being patchedmethod- theMethodNodeof method currently being patched
-