Mixin is a trait/mixin and bytecode weaving framework for Java using ASM
MIT License
Mixin is a trait/mixin framework for Java using ASM and hooking into the runtime classloading process via a set of pluggable built-in or user-provided services. Built-in services currently support Mojang's LegacyLauncher system, though this is deprecated in favour of ModLauncher by cpw, which has greater extensibility and has support for Java 8 and later.
The main documentation for Mixin can be found in the Wiki.
Additional documentation for individual features and annotations can be found in
the extensive Javadoc. For
additional help use the channel #mixin
on the Sponge Discord Server.
Mixin binaries are available via Jenkins and are published to the following maven repositories:
For handling obfuscation tasks, Mixin provides an Annotation Processor
which works at compile time to generate obfuscation mappings for your toolchain
to apply. If using Gradle 5 or later, annotation processors are no longer
automatically loaded from compile
configurations and must be specified
explicitly via annotationProcessor
configurations. For this purpose, Mixin
provides "fat jar" artefacts containing all required dependencies via the
:processor
classifier. For example if your build uses the dependency
org.spongepowered:mixin:1.2.3
then your annotationProcessor configuration
should specify dependency org.spongepowered:mixin:1.2.3:processor
.
If you are using Mixin in a Minecraft Forge project then the MixinGradle plugin can be used to simplify the configuration of the Mixin Annotation Processor. It provides a simple syntax for configuring the Mixin AP for your project, see the MixinGradle README for how to configure MixinGradle.
When developing using Mixin, you can use the Mixin Annotation Processor within Eclipse to provide context-sensitive errors and warnings to help you more easily troubleshoot your mixins. To do so:
gradle build
command to generate the mixin jarJava Compiler
Annotation Processing
-> Factory Path
Enable project specific settings
checkboxAdd External JARs
button and select the generated mixin jar withMixin/build/libs
)Java Compiler
-> Annotation Processing
Enable project specific settings
checkboxEnable annotation processing
checkboxNew...
button next to the Processor options
boxKey
to reobfSrgFile
Value
to the fully-qualified path to the mcp-srg.srg
file (theOK
to apply the changesEnhanced functionality for working with Mixin in IntelliJ IDEA is available via the Minecraft Development for IntelliJ IDEA plugin developed by DemonWav.
Specifying the minVersion
property in your configurations
is extrememly important. The following version history can be used to determine
when features were introduced (and sometimes when major bugs are squashed) in
order to help you determine which minVersion
you should specify.