-
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
![Screenshot 2023-09-28 at 17 00 29](https://private-user-images.githubusercontent.com/18416784/271441925-f5dfc3c8-3bae-456d-adee-9e94765e1f8a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYxNTgyOTQsIm5iZiI6MTcyNjE1Nzk5NCwicGF0aCI6Ii8xODQxNjc4NC8yNzE0NDE5MjUtZjVkZmMzYzgtM2JhZS00NTZkLWFkZWUtOWU5NDc2NWUxZjhhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTEyVDE2MTk1NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTk0MDU0YTllMjMwMWY0MjA3NDRjOTczZGU4NDdhNDU4YjM5NWE2ZTU0YzE2MjcyMjg1NTZhNWY3NmNkM2MzNWMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.SPcnh4cQNQyMPeN278v6CS723syG6QPySrEhjSMIyAU)
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());
}
...
}