Incompatible with Fabric Loader 0.15
modmuss50 opened this issue ยท 3 comments
Mod version
0.5.0+1.17-1.19.4
A description of the issue
Hi, I hope its going well.
We recently released Fabric Loader 0.15.0 as a beta and had a player reach out for support with the following crash report:
After looking into this I believe its caused by your mod when ran on a server, specially the use of the @Environment
annotations within ItemStackMixin
here.
Fabric Loader 0.15.0 fixes a bug that caused fields with this annotation to not be removed when they should have been. Sadly this fix, exposes broken (undefined) behaviour in your mod.
In ItemStackMixin, you have an inject method with the @Environment(EnvType.CLIENT)
annotation, however due to how Mixin works this inject is always applied, even on the server. Previously this wasnt an issue as the fields were not removed, but now they are leading to this crash.
I think the fix here is to remove all the @Environment(EnvType.CLIENT)
, restoring the previous behaviour. The correct way to do client (or server) only Mixins would be to have a seperate Mixin class, and register it in the client
or server
part of the mixin json file.
I would reccomend not using the @Environment annotations if possible, as they have a number of known footguns (such as using them on mixin inject methods). Having seperate classes leads to less issues.
Please let me know if you have any questions or need any help.
Log or crash report
https://gist.github.com/modmuss50/9f6a32809a846da6b9178fc630961b83
My server is having the same issue on 1.19.2. I don't know if MoriyaShiine has plans on updating 1.19, so I am going to try to implement the fixes you described to see if I can help us both out. But, I am incredibly new when it comes to modding and have a basic understanding of Java. o7 soldier
Is it safe to keep @Environment where they usually are but split this mixin into client and server, or should I remove them altogether?