
Add a new enqueueMixin overload?
KameiB opened this issue ยท 2 comments
Can you add an overload to the following method:
FermiumRegistryAPI.enqueueMixin
so it accepts a String modId
, and only apply the mixin if its corresponding mod (the modId in this argument) is in the loading list?
Mixin devs can then call FermiumRegistryAPI.enqueueMixin
and pass the modId as an argument, to indicate that the current mixin depends on that mod.
Example: FermiumRegistryAPI.enqueueMixin(true, myMixin.getJson(), myMixin.getModId());
This would be a nice extra security layer for players that want to enable all mixins but don't want error spam in the latest.log if the corresponding mod doesn't exist in the current instance.
You can get the mod id here:
and add
mod.getModId()
to a List, then use it where it's needed.
I understand this could conflict with the current overload:
But just consider it, please?
By the time;
https://github.com/fonnymunkey/FermiumBooter/blob/main/src/main/java/fermiumbooter/mixin/FermiumMixinLoader.java#L45
is reached, the Loader has already populated the namedMods list, and FermiumBooter creating its own list would be redundant.
You can provide a Supplier of () -> Loader.isModLoaded(modid)
when enqueuing late loaded mixins to have them only be enabled if the relevant modid is present.