MixinExtras icon indicating copy to clipboard operation
MixinExtras copied to clipboard

Deliberate conflict marker

Open Earthcomputer opened this issue 1 year ago • 2 comments
trafficstars

Add an annotation (say, @Conflict), that can be added to an injector to mark it as conflicting with other injectors that target the same instruction. This tells MixinExtras to fail the injection in this case.

This has the following advantages:

  • Ability to explicitly conflict with other injectors in cases where this is not currently possible (e.g. with injection points that can only be used on non-conflicting injectors)
  • Clarifies the intention that the injector should be conflicting
    • This makes it easier for tools such as mcdev to know if a conflicting injector is intentional.
  • Possibility for future expansion of scope (e.g. conflicting under certain conditions)

Earthcomputer avatar Jul 30 '24 12:07 Earthcomputer

Would it cause conflicts only with other injectors marked as Conflicting?

LlamaLad7 avatar Jul 30 '24 12:07 LlamaLad7

My idea was to conflict with any injector which targets the same instruction, regardless of what that other injector is or how it's annotated. But more complicated options could certainly be added to the annotation

Earthcomputer avatar Jul 30 '24 20:07 Earthcomputer

I would request a @NoConflict annotation (or similar name) that can override this but will blame the mod using it prominently in crash logs.

@NoConflict should only apply if the mixin class it is in has a higher priority than other mixin classes that are applying a @Conflict to the targeted instruction. A way to limit the @NoConflict to specific mixin classes could be useful too.

My usecase is that I might want to carefully write an injector that I'm willing to guarantee will be compatible with a specific other mod (but of course I should then get the blame if things explode).

techno-sam avatar Jan 10 '25 00:01 techno-sam