-
Notifications
You must be signed in to change notification settings - Fork 2
Mixin Canceller
Making a PR or raising an issue would be more suitable
MixinSquared provides a way to cancel the application of Mixins that would normally be out of a user's control as other mod's mixins are not passed through their IMixinConfigPlugin
.
If you wish to only cancel a specific injector, the Annotation Adjuster may be more suitable.
Using the canceller is quite simple, all you need to do is implement the MixinCanceller
interface and then register it.
public class YourModMixinCanceller implements MixinCanceller {
@Override
public boolean shouldCancel(List<String> targetClassNames, String mixinClassName) {
return /* your own logic on whether to cancel mixins by their name or what they're targeting */;
}
}
Inside your fabric.mod.json
you will need to add the following entrypoint:
"entrypoints": {
"mixinsquared": [
"com.example.mod.YourModMixinCanceller"
]
}
You will need to declare a service called com.bawnorton.mixinsquared.api.MixinCanceller
inside the META-INF/services/
directory.
The content of this file will need to be a reference to your MixinCanceller
implementation(s):
com.example.mod.YourModMixinCanceller
In the onLoad
method inside a IMixinConfigPlugin
you can register a MixinCanceller
directly using the MixinCancellerRegistrar
like so:
public class YourModMixinConfigPlugin implements IMixinConfigPlugin {
@Override
public void onLoad(String mixinPackage) {
MixinCancellerRegistrar.register(new YourModMixinCanceller());
}
...
}