LlamaLad7 / MixinExtras

Companion library to SpongePowered Mixin with many custom injectors for a more expressive experience.
MIT License
293 stars 16 forks source link

[Suggestion] Way to intentionally share a `@Share` between two mixins #72

Closed TropheusJ closed 1 month ago

TropheusJ commented 5 months ago

a @Share is unique to a mixin, which is very good for compatibility, but that behavior can occasionally be desired.

For Porting Lib, I need to wrap a parameter as early as possible, and then access it later as late as possible. I am doing this with two mixins, one with low priority, and one with high. Since it's split, I can't use a @Share, and I'll have to use a ThreadLocal.

Gaming32 commented 5 months ago

I think a solution would be to have an option to expand the scope to within the current mixin config, if that's possible.

LlamaLad7 commented 5 months ago

I think the most general solution would be to allow you to specify a namespace, which would default to the name of your mixin (the current behaviour).

Gaming32 commented 5 months ago

It can't default to exactly the name of your mixin, because mixin names are fairly standardized. For example, the number of MixinBlock/BlockMixin or MixinLivingEntity/LivingEntityMixin are probably in the thousands.

LlamaLad7 commented 5 months ago

The fully qualified name.

Gaming32 commented 5 months ago

Fair enough