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

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      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.
      java.lang.String methodDesc()
      This should return the target method's descriptor.
      java.lang.String methodName()
      This is used to identify the method to transform within the class.
      java.lang.String name()  
      default java.lang.String reason()  
      java.lang.String targetClass()
      This is used to identify which classes should be altered, and on which class should this injector operate.
    • Method Detail

      • name

        java.lang.String name()
        Returns:
        name of injector, for logging
      • reason

        default java.lang.String reason()
        Returns:
        reason for this patch, for logging
      • targetClass

        java.lang.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

        java.lang.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

        java.lang.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
        See ASM's documentation for a more detailed explanation.
        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 logic for actually pathing.
        Parameters:
        clazz - the ClassNode currently being patched
        method - the MethodNode of method currently being patched