Skip to content

Companion library to SpongePowered Mixin with many custom injectors for a more expressive experience.

License

Notifications You must be signed in to change notification settings

LlamaLad7/MixinExtras

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ea94089 · Oct 13, 2023
Sep 16, 2023
Sep 2, 2023
Sep 23, 2023
Oct 13, 2023
Jan 5, 2022
Mar 22, 2023
Jul 6, 2023
Oct 13, 2023
Jan 5, 2022
Jan 5, 2022
Sep 24, 2023
Sep 2, 2023
Sep 2, 2023

Repository files navigation

MixinExtras

A small companion library to Mixin, designed to help you write your Mixins in a more expressive and compatible way.

More information about each feature offered can be found at the Wiki.

If you are using 0.2.0-beta.5 or later you need to follow the new README instead.

Setup

For the time being, I recommend depending on this library via JitPack. After adding its repository to your build script, you can depend on it like so

dependencies {
    implementation("com.github.LlamaLad7:MixinExtras:0.1.1")
    annotationProcessor("com.github.LlamaLad7:MixinExtras:0.1.1")
}

It is essential that you register MixinExtras as an annotation processor if you want remapping of custom features to work. If you are registering Mixin as an annotation processor too, you must register the MixinExtras annotation processor before the Mixin one.

Bundling MixinExtras

If you intend to use this library in your mod, you will probably need to bundle it in your jar.

If you are on Fabric, I recommend using the include configuration in your dependencies block.

If you are on another platform, I recommend the Shadow Gradle Plugin. You also need to relocate MixinExtras to avoid conflicts with different versions of the library, and you need to tell the plugin to mergeServiceFiles if you are on Java 9+.

Initialization

The final step after setting up your build script is to initialize MixinExtras. To do this, simply call

MixinExtrasBootstrap.init();

somewhere suitably early in your program. On Fabric, this would be a PreLaunch entrypoint. If you cannot find a suitable place for your platform, you might like to use an IMixinConfigPlugin . Initializing MixinExtras in your plugin's onLoad method should work fine on any platform (except Fabric loader <= 0.14.10! [1]).

You're good to go!

Enjoy using the library, and don't hesitate to open an issue if you have any feedback, questions or suggestions.

Footnotes

[1] FabricLoader had an issue meaning a crash occurred if the very first class loaded on KnotClassLoader was also referenced from a mixin plugin. MixinExtrasBootstrap is frequently the first class loaded there since lots of people initialize it from a preLaunch entrypoint. As such, please do that and do not initialize it from a mixin plugin. This has been resolved in Fabric Loader 0.14.11, but that's not very widely used yet.