Package cpw.mods.modlauncher.serviceapi
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.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
static interface
static enum
Indicates where theprocessClass(Phase, ClassNode, Type)
method should be called. -
Method Summary
Modifier and TypeMethodDescriptiondefault void
addResources
(List<cpw.mods.jarhandling.SecureJar> resources) Offer scan results from TransformationServices to this plugin.default void
customAuditConsumer
(String className, Consumer<String[]> auditDataAcceptor) Receives a call immediately after handlesClass for any transformer that declares an interest.default <T> T
Get a plugin specific extension object from the plugin.handlesClass
(org.objectweb.asm.Type classType, boolean isEmpty) If this plugin wants to receive theClassNode
intoprocessClass(cpw.mods.modlauncher.serviceapi.ILaunchPluginService.Phase, org.objectweb.asm.tree.ClassNode, org.objectweb.asm.Type)
default EnumSet
<ILaunchPluginService.Phase> handlesClass
(org.objectweb.asm.Type classType, boolean isEmpty, String reason) If this plugin wants to receive theClassNode
intoprocessClass(cpw.mods.modlauncher.serviceapi.ILaunchPluginService.Phase, org.objectweb.asm.tree.ClassNode, org.objectweb.asm.Type)
default void
initializeLaunch
(ILaunchPluginService.ITransformerLoader transformerLoader, NamedPath[] specialPaths) name()
The name of this plugin.default void
offerResource
(Path resource, String name) Adds a resource to this plugin for processing by it.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.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.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.
-
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
If this plugin wants to receive theClassNode
intoprocessClass(cpw.mods.modlauncher.serviceapi.ILaunchPluginService.Phase, org.objectweb.asm.tree.ClassNode, org.objectweb.asm.Type)
- Parameters:
classType
- the class to considerisEmpty
- 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) If this plugin wants to receive theClassNode
intoprocessClass(cpw.mods.modlauncher.serviceapi.ILaunchPluginService.Phase, org.objectweb.asm.tree.ClassNode, org.objectweb.asm.Type)
- Parameters:
classType
- the class to considerisEmpty
- 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 anILaunchPluginService
- 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 ofprocessClass(Phase, ClassNode, Type)
,processClass(Phase, ClassNode, Type, String)
orprocessClassWithFlags(Phase, ClassNode, Type, String)
must be implemented.- Parameters:
phase
- The phase of the supplied class nodeclassNode
- the classnode to processclassType
- 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 nodeclassNode
- the classnode to processclassType
- the name of the classreason
- Reason for transformation. "classloading" or the name of anILaunchPluginService
- 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 nodeclassNode
- the classnode to processclassType
- the name of the classreason
- Reason for transformation. "classloading" or the name of anILaunchPluginService
- Returns:
- The
ILaunchPluginService.ComputeFlags
for this class
-
offerResource
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
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
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 transformedauditDataAcceptor
- accepts an array of strings to add a new audit trail record with the data
-