Skip to content
/ Mixin Public
forked from SpongePowered/Mixin

Mixin is a trait/mixin and bytecode weaving framework for Java using ASM

License

Notifications You must be signed in to change notification settings

BookMC/Mixin

Repository files navigation

Build Status

Mixin Logo

Mixin is a trait/mixin framework for Java using ASM and hooking into the runtime class-loading process via Mojang's LegacyLauncher system. 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 #spongedev on the Espernet IRC network.

Building Mixin

Mixin uses the Gradle build automation system. To perform a build, use gradle version 2.11 and execute

gradle

from within the project root directory. (If you do not have Gradle installed on your system you can instead run the supplied Gradle wrapper gradlew)

Integration with Eclipse IDE

The Mixin project can be integrated easily with Eclipse using the Gradle Plugin. Simply choose Import -> Gradle Project and follow the prompts.

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:

  1. Run the gradle build command to generate the mixin jar
  2. Open the properties of your eclipse project and navigate to Java Compiler -> Annotation Processing -> Factory Path
  3. Check the Enable project specific settings checkbox
  4. Click the Add External JARs button and select the generated mixin jar with the suffix -processor (hint: it should be in Mixin/build/libs)
  5. Navigate up one level to Java Compiler -> Annotation Processing
  6. Check the Enable project specific settings checkbox
  7. Check the Enable annotation processing checkbox
  8. Click the New... button next to the Processor options box
  • Set Key to reobfSrgFile
  • Set Value to the fully-qualified path to the mcp-srg.srg file (for Sponge this can be found in Sponge/build/srgs/mcp-srg.srg)
  1. Click OK to apply the changes

Integration with IntelliJ IDEA IDE

Enhanced functionality for working with Mixin in IntelliJ IDEA is available via the Minecraft Development for IntelliJ IDEA plugin developed by DemonWav.

Version History

Version Features / Changes Date
0.1
  • Basic Mixin Support
  • Basic Injector Support
  • Annotation Processor
January 2015
0.2
  • Added supermixin support (mixins inheriting from other mixins)
March 2015
0.3
  • Implemented Environments
  • Intrinsic method support
  • Enabled local variable capture
  • Alias support
March 2015
0.3.1
  • Annotation Merging
  • Allow Overwrite methods to be aliased
April 2015
0.3.2
  • Error handler support
April 2015
0.4
  • Shade relocated ASM package and use throughout
May 2015
0.4.3
  • Add INVOKE_ASSIGN injection point
  • Support injector callbacks without args
  • Support coercion of covariant parameter types in callbacks
  • Support truncating local-capturing injector handlers
  • Runtime decompilation of exported classes using fernflower
  • Add export filter
May 2015
0.4.4
  • Add constraints for overwrites
July 2015
0.4.6
  • Add INIT phase for handling early FML startup
  • Add support for lambdas in mixins
  • Add support for hot code replacement in mixins
  • Improve Java 8 feature support
September 2015
0.4.8
  • Annotation Processor improved to support MixinGradle
  • Support multiple target obfuscation environments in refmaps
December 2015
0.4.10
  • Runtime remapping support using RemapperChain
  • Ignore class transformers decorated with @Resource
  • Support @reason and @author validation on overwrites
December 2015
0.4.11
  • Add support for injector grouping and config-wide require value
January 2016
0.4.13
  • Add @Final annotation
January 2016
0.4.14
  • Add support for interface mixins
January 2016
0.4.15
  • Include soft targets in refmap
January 2016
0.4.17
  • Support ExtraSRGs in Annotation Processor
  • Include constructors in reference map
  • Add @Mutable annotation to suppress @Final warnings
January 2016
0.4.18
  • Add @ModifyLocal injector
February 2016
0.4.19
  • Add support for @Redirect on fields as well as methods
February 2016
0.5.1
  • Overhaul injectors, injectors from all mixins now scan before any injectors are actually processed. Makes injectors more deterministic.
February 2016
0.5.2
  • Support ID on injectors
  • Support priority for injectors
February 2016
0.5.3
  • Conform injectors
  • Enable hotswapper automatically if agent is active
  • Fix multiple issues with generics in Annotation Processors
February 2016
0.5.4
  • Error handlers also receive mixin prepare errors
April 2016
0.5.5
  • Add @ModifyConstant injector
  • Add @Debug annotation
  • Allow static @ModifyArg handlers in instance methods
April 2016
0.5.6
  • Environment changes, support environment via agents
May 2016
0.5.7
  • Add @Unique annotation
June 2016
0.5.8
  • Support constraints on injectors
June 2016
0.5.9
  • Hard fail if a required mixin target was already transformed
June 2016
0.5.10
  • Support @Unique on fields
June 2016
0.5.13
  • Add alternative strategy for injecting field initialisers
September 2016
0.5.14
  • Add async decompilation support
September 2016
0.5.16
  • Annotation Processor improvements. Support shadows and overrides in multi-target mixins
  • Support pluggable obfuscation environments in AP
October 2016
0.5.17
  • Allow @Redirect injectors to target NEW opcodes for constructor redirection
October 2016
0.6
  • Accessor Mixin support
October 2016
0.6.1
  • Process soft-implements annotations in the AP
November 2016
0.6.2
  • Add support for @Pseudo (virtual target) mixins
December 2016
0.6.3
  • SourceDebugExtension support
December 2016
0.6.4
  • Allow descriptors on NEW injection points
January 2017
0.6.5
  • Add support for injector slices
January 2017
0.6.6
  • Allow static methods in accessor mixins in Java 8 and above
January 2017
0.6.7
  • Add support for @Redirect on array access
January 2017
0.6.8
  • Allow @ModifyConstant to hook implicit zero in comparisons
February 2017
0.6.10
  • (0.6.9) Minor fix to remove dependence on deprecated helper
  • Respect remap on Mixin for contained @At
  • Require redirectors which occur before call to superctor to be static
May 2017
0.6.11
  • Fix handling of @Unique when the same unique method exists in more than one mixin targetting the same class
  • Fix handling of merged lambdas so that lambdas from mixins are applied correctly when lambdas already exist in the target class (both in the original class and when applied by earlier mixins)
June 2017
0.6.12
  • Add slice argument to @ModifyConstant
  • Add @ModifyArgs injector which can change multiple method call arguments with a single handler.
June 2017
0.6.13
  • Add support for conforming visibility of overwrite methods to match target class. Fixes issues where a target class method has been modified by an Access Transformer to have higher visibility
July 2017
0.6.14
  • Add support for using @Coerce on reference types in Callback Injectors to support derived types.
July 2017
0.6.15
  • Add support for multiple constants in ModifyConstant
  • Add CONSTANT as general-purpose injection point
  • Add support for redirecting array length access in field redirectors
July 2017
0.7
  • All official binaries are now signed
  • Upgrade to ASM 5.2
  • Add support for inner classes in Mixins
  • Injectors can now have multiple explicit targets
  • @At annotations can now have their own id
  • Add support for using @Overwrite on non-obfuscated methods as a way of verifying that an overwrite target exists
  • Improve support for synthetic bridges, detect conflicting bridge methods
  • Detect and warn of excessive At.Shift.BY values
  • ModifyConstant can now support multiple slices
  • Add allow to injectors to detect over-injection
July 2017
0.7.1
  • Fixes and improvements to the Mixin AP, fixing handling of multi- dimensional arrays and resolving methods in superclasses of derived types of obfuscated classes
  • Add runtime refmap remapping to support using deobfCompile dependencies with different mapping versions.
August 2017
0.7.2
  • Add profiler for inspecting mixin performance.
August 2017
0.7.3
  • Internal changes to provide for support modlauncher and java 9
August 2017
0.7.4
  • Added @Dynamic annotation for decorating mixin elements with dynamically-injected targets.
September 2017

About

Mixin is a trait/mixin and bytecode weaving framework for Java using ASM

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%