Are Final mixins overwritter by normal Forge transformers?

I was testing my mod and how it reacted to another mod that used transformers to kill the player. In my tests, I noticed that using Overwrite and Final on the onDeath method, and returning immediately, did not prevent the other mod from being able to kill me. It still managed to execute the onDeath method. However, when I tested using Inject at the head, I noticed that this behavior didn’t occur, and I was able to cancel the onDeath. My theory is that the Inject always stays at the top regardless of the substitution, which is why it always works.

Realistically it’s best to avoid Overwrite in general unless you absolutely can’t avoid it. The answer is “it depends”. Basically mixins should always run after any other transformers, but there are ways around this, usually intentional.

Overwrites and injectors happen - from your point of view - at the same time, so the two approaches shouldn’t be different. But in the case where a transformer does run after the mixin, the behaviour may be different for each: i.e. when a transformer modifies the method RETURN opcode. In the short-circuit injector this would still inhibit the method, the Overwrite would not.

The contract of @Final is only enforced by Mixin on other mixins so when dealing with other non-Mixin transformers it’s basically irrelevant.

If in doubt, you can always inspect the classloaded bytecode using the built-in class dump features, using Mixin’s export feature will only show you the bytecode as it is when it leaves the Mixin pipeline and thus won’t include any changes (if any) that are made afterward.