Class MixinTransformer
java.lang.Object
org.spongepowered.asm.transformers.TreeTransformer
org.spongepowered.asm.mixin.transformer.MixinTransformer
- All Implemented Interfaces:
IMixinTransformer,ILegacyClassTransformer,ITransformer
Transformer which manages the mixin configuration and application process
-
Method Summary
Modifier and TypeMethodDescriptionvoidaudit(MixinEnvironment environment) Run audit process on current mixin processorbooleancomputeFramesForClass(MixinEnvironment environment, String name, org.objectweb.asm.tree.ClassNode classNode) Called when the transformation reason is computing_frames.booleancouldTransformClass(MixinEnvironment environment, String name) Determines whether mixin could transform the provided class, without actually running the transformationbyte[]generateClass(MixinEnvironment environment, String name) Generate the specified mixin-synthetic classbooleangenerateClass(MixinEnvironment environment, String name, org.objectweb.asm.tree.ClassNode classNode) Get the transformer extensionsgetName()Get the identifier for this transformer, usually the class name but for wrapped transformers this is the class name of the wrapped transformerbooleanGet whether this transformer is excluded from delegation.Callback from hotswap agentbyte[]transformClass(MixinEnvironment environment, String name, byte[] classBytes) Apply mixins and postprocessors to the supplied classbooleantransformClass(MixinEnvironment environment, String name, org.objectweb.asm.tree.ClassNode classNode) Apply mixins and postprocessors to the supplied classbyte[]transformClassBytes(String name, String transformedName, byte[] basicClass) Callback from the hotswap agent and LaunchWrapper Proxy, transform class bytecode.Methods inherited from class org.spongepowered.asm.transformers.TreeTransformer
readClass, readClass, writeClass
-
Method Details
-
getExtensions
Description copied from interface:IMixinTransformerGet the transformer extensions- Specified by:
getExtensionsin interfaceIMixinTransformer
-
getName
Description copied from interface:ITransformerGet the identifier for this transformer, usually the class name but for wrapped transformers this is the class name of the wrapped transformer- Specified by:
getNamein interfaceITransformer- Returns:
- transformer's identifying name
-
isDelegationExcluded
public boolean isDelegationExcluded()Description copied from interface:ITransformerGet whether this transformer is excluded from delegation. Some transformers (such as the mixin transformer itself) should not be included in the delegation list because they are re-entrant or do not need to run on incoming bytecode.- Specified by:
isDelegationExcludedin interfaceITransformer- Returns:
- true if this transformer should be excluded from the transformer delegation list
-
audit
Run audit process on current mixin processor- Specified by:
auditin interfaceIMixinTransformer- Parameters:
environment- Environment for audit
-
reload
Callback from hotswap agent- Specified by:
reloadin interfaceIMixinTransformer- Parameters:
mixinClass- Name of the mixinclassNode- New class- Returns:
- List of classes that need to be updated
-
transformClassBytes
Description copied from interface:IMixinTransformerCallback from the hotswap agent and LaunchWrapper Proxy, transform class bytecode. This method delegates to class generation or class transformation based on whether the supplied byte array is null and is therefore suitable for hosts which follow the LaunchWrapper contract.- Specified by:
transformClassBytesin interfaceILegacyClassTransformer- Specified by:
transformClassBytesin interfaceIMixinTransformer- Parameters:
name- Class nametransformedName- Transformed class namebasicClass- class bytecode- Returns:
- transformed class bytecode
- See Also:
-
computeFramesForClass
public boolean computeFramesForClass(MixinEnvironment environment, String name, org.objectweb.asm.tree.ClassNode classNode) Called when the transformation reason is computing_frames. The only operation we care about here is adding interfaces to target classes but at the moment we don't have sufficient scaffolding to determine that without triggering re-entrance. Currently just a no-op in order to not cause a re-entrance crash under ModLauncher 7.0+.- Specified by:
computeFramesForClassin interfaceIMixinTransformer- Parameters:
environment- Current environmentname- Class transformed nameclassNode- Class tree- Returns:
- true if the class was transformed
-
transformClass
Apply mixins and postprocessors to the supplied class- Specified by:
transformClassin interfaceIMixinTransformer- Parameters:
environment- Current environmentname- Class transformed nameclassBytes- Class bytecode- Returns:
- Transformed bytecode
-
transformClass
public boolean transformClass(MixinEnvironment environment, String name, org.objectweb.asm.tree.ClassNode classNode) Apply mixins and postprocessors to the supplied class- Specified by:
transformClassin interfaceIMixinTransformer- Parameters:
environment- Current environmentname- Class transformed nameclassNode- Class tree- Returns:
- true if the class was transformed
-
couldTransformClass
Determines whether mixin could transform the provided class, without actually running the transformation- Specified by:
couldTransformClassin interfaceIMixinTransformer- Parameters:
environment- Current environmentname- Class transformed name- Returns:
- true if the class could be transformed
-
generateClass
Generate the specified mixin-synthetic class- Specified by:
generateClassin interfaceIMixinTransformer- Parameters:
environment- Current environmentname- Class name to generate- Returns:
- Generated bytecode or null if no class was generated
-
generateClass
public boolean generateClass(MixinEnvironment environment, String name, org.objectweb.asm.tree.ClassNode classNode) - Specified by:
generateClassin interfaceIMixinTransformer- Parameters:
environment- Current environmentname- Class transformed nameclassNode- Empty classnode to populate- Returns:
- True if the class was generated successfully
-