ModifyReceiver¶
Info
For a more in-depth explanation, see the MixinExtra's Wiki.
Say we had a class:
And we want to replace the receiver outright. We can do:
@ModifyReceiver(method = "foo", at = @At(value = "INVOKE", target = "setBar(I)V"))
private void changeReceiver(Bar bar, int newBar) {
if (newBar > 0) {
return quux;
} else {
return bar;
}
}
With this, we have conditionally replaced the receiver for the setbar call:
private void foo() {
...
if (newBar > 0) {
quux.setBar(newBar);
} else {
bar.setBar(newBar);
}
...
}
This page is directly based off of LlamaLad7's MixinExtra Wuju page for ModifyReceivers.