Interface ILaunchPluginService

All Known Implementing Classes:
AccessTransformerService, NeoForgeDevDistCleaner, RuntimeEnumExtender, SLF4JFixerLaunchPluginService

public interface ILaunchPluginService
Loaded from the initial classpath of the system to identify plugins that wish to work across the system. Mixin and AccessTransformer provide instances. Other plugins can also be added here, but their services are likely not to be called upon.
  • Method Details

    • name

      String name()
      The name of this plugin. Must be unique. Multiple plugins by the same name will result in a hard exit. Launcher and other systems will rely on this name to find services provided by this plugin, so it should be stable.
      Returns:
      the name of the plugin
    • handlesClass

      EnumSet<ILaunchPluginService.Phase> handlesClass(org.objectweb.asm.Type classType, boolean isEmpty)
      Parameters:
      classType - the class to consider
      isEmpty - if the class is empty at present (indicates no backing file found)
      Returns:
      the set of Phases the plugin wishes to be called back with
    • handlesClass

      default EnumSet<ILaunchPluginService.Phase> handlesClass(org.objectweb.asm.Type classType, boolean isEmpty, String reason)
      Parameters:
      classType - the class to consider
      isEmpty - if the class is empty at present (indicates no backing file found)
      reason - Reason for transformation request. "classloading" - cpw.mods.modlauncher.api.ITransformerActivity#CLASSLOADING_REASON "computing_frames" - cpw.mods.modlauncher.api.ITransformerActivity#COMPUTING_FRAMES_REASON or the name of an ILaunchPluginService
      Returns:
      the set of Phases the plugin wishes to be called back with
    • processClass

      default boolean processClass(ILaunchPluginService.Phase phase, org.objectweb.asm.tree.ClassNode classNode, org.objectweb.asm.Type classType)
      Each class loaded is offered to the plugin for processing. Ordering between plugins is not known. One of processClass(Phase, ClassNode, Type), processClass(Phase, ClassNode, Type, String) or processClassWithFlags(Phase, ClassNode, Type, String) must be implemented.
      Parameters:
      phase - The phase of the supplied class node
      classNode - the classnode to process
      classType - the name of the class
      Returns:
      true if the classNode needs rewriting using COMPUTE_FRAMES or false if it needs no NO_REWRITE
    • processClass

      default boolean processClass(ILaunchPluginService.Phase phase, org.objectweb.asm.tree.ClassNode classNode, org.objectweb.asm.Type classType, String reason)
      Each class loaded is offered to the plugin for processing. Ordering between plugins is not known.
      Parameters:
      phase - The phase of the supplied class node
      classNode - the classnode to process
      classType - the name of the class
      reason - Reason for transformation. "classloading" or the name of an ILaunchPluginService
      Returns:
      true if the classNode needs rewriting using COMPUTE_FRAMES or false if it needs no NO_REWRITE
    • processClassWithFlags

      default int processClassWithFlags(ILaunchPluginService.Phase phase, org.objectweb.asm.tree.ClassNode classNode, org.objectweb.asm.Type classType, String reason)
      Each class loaded is offered to the plugin for processing. Ordering between plugins is not known.
      Parameters:
      phase - The phase of the supplied class node
      classNode - the classnode to process
      classType - the name of the class
      reason - Reason for transformation. "classloading" or the name of an ILaunchPluginService
      Returns:
      The ILaunchPluginService.ComputeFlags for this class
    • offerResource

      default void offerResource(Path resource, String name)
      Adds a resource to this plugin for processing by it. Used by forge to hand resources to access transformers for example.
      Parameters:
      resource - The resource to be considered by this plugin.
      name - A name for this resource.
    • addResources

      default void addResources(List<cpw.mods.jarhandling.SecureJar> resources)
      Offer scan results from TransformationServices to this plugin.
      Parameters:
      resources - A collection of all the results
    • initializeLaunch

      default void initializeLaunch(ILaunchPluginService.ITransformerLoader transformerLoader, NamedPath[] specialPaths)
    • getExtension

      default <T> T getExtension()
      Get a plugin specific extension object from the plugin. This can be used to expose proprietary interfaces to Launchers without ModLauncher needing to understand them.
      Type Parameters:
      T - The type of the extension
      Returns:
      An extension object
    • customAuditConsumer

      default void customAuditConsumer(String className, Consumer<String[]> auditDataAcceptor)
      Receives a call immediately after handlesClass for any transformer that declares an interest. the consumer can be called repeatedly to generate new AuditTrail entries in the audit log.
      Parameters:
      className - className that is being transformed
      auditDataAcceptor - accepts an array of strings to add a new audit trail record with the data