Package org.spongepowered.asm.mixin
Annotation Type Mixin
-
@Target(TYPE) @Retention(CLASS) public @interface MixinThe main decorator for mixin classes, this annotation denotes a class as a mixin and specifies two key attributes:- The target classes
- Every mixin requires at least one target class in order to be valid.
The target classes should be specified via
value()where possible using class literals. However for anonymous inner classes, package-private classes, or unavailable classes (eg. synthetic classes) being targetted via@Pseudo, the targets should be specified via thetargets()instead. - The priority
- The mixin
priority()is used to express the mixin's desired ordering with respect to other mixins being applied to the same target class.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description intpriorityPriority for the mixin, relative to other mixins targetting the same classes.booleanremapBy default, the annotation processor will attempt to locate an obfuscation mapping for allOverwrite,ShadowandInjectannotated members since it is anticipated that in general the target of aMixinwill be an obfuscated class and all annotated members will need to be added to the obfuscation table.java.lang.String[]targetsjava.lang.Class<?>[]valueTarget class(es) for this mixin
-
-
-
-
targets
java.lang.String[] targets
Since specifying targets invalue()requires that the classes be publicly visible, this property is provided to allow package-private, anonymous innner, and private inner, or unavailable (@Pseudoclasses to be referenced. Referencing an otherwise public class using this property is an error condition and will raise a warning at runtime or an error ifstrict checksare enabled. It is completely fine to specify both publi and private targets for the same mixin however.Note that unlike class literals specified in
value(), imports are not supported and therefore the class specified here must be fully-qualified with the package name.- Returns:
- protected, package-private, or
pseudoclasses this mixin targets
- Default:
- {}
-
-
-
priority
int priority
Priority for the mixin, relative to other mixins targetting the same classes. By default mixins inherit their priority from the parent configuration that contains them, setting this value allows the priority to be overridden on a per-mixin basis.Priorities sort mixins into natural order with lower priority mixins being applied first. This changes the nature of priority based on your intentions. Especially with respect to injectors, which must be considered on a case-by-case basis since the semantics of priority vary by injector because of first-come-first-served versus implied ordering of injectors such as inject-at-HEAD.
- Returns:
- the mixin priority (relative to other mixins targetting the same class)
- Default:
- 1000
-
-
-
remap
boolean remap
By default, the annotation processor will attempt to locate an obfuscation mapping for allOverwrite,ShadowandInjectannotated members since it is anticipated that in general the target of aMixinwill be an obfuscated class and all annotated members will need to be added to the obfuscation table. However since it is possible to also apply mixins to non-obfuscated targets it may be desirable to suppress the compiler warnings which would otherwise be generated. This can be done on an individual member basis by settingremapto false on the individual annotations, or disabled for the entire mixin by setting the value here to false. Doing so will cause the annotation processor to skip all annotations in this mixin when building the obfuscation table unless the individual annotation is explicitly decorated with remap = true.- Returns:
- True to instruct the annotation processor to search for obfuscation mappings for this annotation (default true).
- Default:
- true
-
-