Class MixinTransformer<M>
- java.lang.Object
-
- org.stianloader.micromixin.transform.api.MixinTransformer<M>
-
- Type Parameters:
M- The modularity attachment type. Modularity attachments are needed to pin down the source of a mixin. This reduces the chance of incompatibilities between mods loaded by two different classloaders. The modularity attachment should ideally implementObject.equals(Object)andObject.hashCode()if the identity comparison semantics of the default implementations are a potential issue. A recommended type can beClassLoader, but really anything goes,Voidfor example is perfectly fine as long as theBytecodeProvideraccounts for null attachments. All methods inMixinTransformersupport null attachments internally, albeit it is not recommended to use null for any method.
public class MixinTransformer<M> extends java.lang.ObjectThe central brain of Micromixin. An instance of this class stores all mixin-related matters. Multiple instances can be used at the same time, as long as their inputs are separated.
-
-
Constructor Summary
Constructors Constructor Description MixinTransformer(BytecodeProvider<M> bytecodeProvider, ClassWrapperPool pool)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddMixin(M attachment, MixinConfig config)InjectionPointSelectorFactorygetInjectionPointSelectors()Obtains theInjectionPointSelectorFactorythat can be used to register custom injection point selectors.MixinLoggingFacadegetLogger()ClassWrapperPoolgetPool()booleanisDelayingParseExceptions()booleanisMergingClassFileVersions()booleanisMixin(M attachment, java.lang.String internalName)Returns whether a package or a class is within a mixin.booleanisMixinTarget(java.lang.String name)voidsetDelayParseExceptions(boolean delayParseExceptions)voidsetLogger(MixinLoggingFacade logger)voidsetMergeClassFileVersions(boolean mergeClassFileVersions)voidtransform(org.objectweb.asm.tree.ClassNode in)Deprecated.voidtransform(org.objectweb.asm.tree.ClassNode in, java.net.URI classCodeSourceURI)
-
-
-
Constructor Detail
-
MixinTransformer
public MixinTransformer(@NotNull BytecodeProvider<M> bytecodeProvider, @NotNull ClassWrapperPool pool)
-
-
Method Detail
-
addMixin
public void addMixin(M attachment, @NotNull MixinConfig config)
-
getInjectionPointSelectors
@NotNull @Contract(pure=true) public InjectionPointSelectorFactory getInjectionPointSelectors()
Obtains theInjectionPointSelectorFactorythat can be used to register custom injection point selectors.The instance is specific to this specific
MixinTransformer. Registering an injection point selector to the factory of this instance will not have an effect of any mixins registered via any other transformers.- Returns:
- The active
InjectionPointSelectorFactoryinstance.
-
getLogger
@NotNull public MixinLoggingFacade getLogger()
-
getPool
@NotNull public ClassWrapperPool getPool()
-
isDelayingParseExceptions
public boolean isDelayingParseExceptions()
-
isMergingClassFileVersions
public boolean isMergingClassFileVersions()
-
isMixin
public boolean isMixin(M attachment, @NotNull java.lang.String internalName)
Returns whether a package or a class is within a mixin. Such classes or packages should not be loaded by the classloader.The internal name must be represented as a fully qualified name using slashes ('/') as package separators.
- Parameters:
attachment- The modularity attachment to useinternalName- The internal name of the package or class- Returns:
- True if it is within the package, false otherwise.
-
isMixinTarget
public boolean isMixinTarget(@NotNull java.lang.String name)
-
setDelayParseExceptions
public void setDelayParseExceptions(boolean delayParseExceptions)
-
setLogger
public void setLogger(@NotNull MixinLoggingFacade logger)
-
setMergeClassFileVersions
public void setMergeClassFileVersions(boolean mergeClassFileVersions)
-
transform
@Deprecated @Obsolete public void transform(@NotNull org.objectweb.asm.tree.ClassNode in)Deprecated.
-
transform
@AvailableSince("0.7.0-a20241008") public void transform(@NotNull org.objectweb.asm.tree.ClassNode in, @Nullable java.net.URI classCodeSourceURI)
-
-