You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Observed Behavior: When using @Mod.EventBusSubscriber on an Item class implementing ICurioItem, the game will crash when trying to run multiplayer (only tested this within a development environment).
Expected Behavior: The game in multiplayer not crashing from this combination of code usage.
Steps to Reproduce:
Create a class that extends Item
Annotate it with @Mod.EventBusSubscriber (no parameters necessary)
Make the item class implement ICurioItem
runServer within the development environment
The run will fail with the error java.lang.RuntimeException: Attempted to load class com/mojang/blaze3d/matrix/MatrixStack for invalid dist DEDICATED_SERVER
This issue was narrowed down to seemingly being caused by Curios from the debug log (https://pastebin.com/1dmB6Vvd) showing the run failing when trying to load the automatic subscriber for IcePendantItem. Removing the @Mod.EventBusSubscriber annotation made the class work just fine afterwards with no crashes. When trying to troubleshoot this I was told this may be caused by ICurioItem.render() not being annotated with @OnlyIn(Side.CLIENT), but you would probably know better what the cause of the issue could be here.
The text was updated successfully, but these errors were encountered:
This is an issue that I'm aware of. It is indeed caused by the render methods, which will attempt to be class-loaded on the server if you try to subscribe the item to an event bus. I'm not sure if it can be readily solved by adding an @OnlyIn(Side.CLIENT) annotation, and I worry about how that might interact with existing implementations, but I'll look into it.
For now, until the rendering gets restructured in 1.17, the workaround is to implement your curios as a capability using the Item's initCapabilities method and the ICurio interface, which I believe should get around these errors. Or you can refactor your events outside the item entirely, it depends on which method is more convenient for your use-case.
When this issue was first brought up, I did try to simply annotate the rendering methods with @OnlyIn(Side.CLIENT) but this only served to throw other class-loading errors and I dismissed that as a solution for 1.16.5. Today, while working on other issues, I decided to take another look at this again. For some reason, adding the annotation worked perfectly this time. Therefore, after some testing, I've included that change in the latest update and I do not believe it should cause any issues with existing implementations.
I do apologize that such a trivial fix took so long to implement.
I will also note that I refactored rendering into a separate class in 1.17+ so this issue is no longer a concern going forward.
Versions (Be specific, do not write "latest"):
Observed Behavior: When using
@Mod.EventBusSubscriber
on an Item class implementingICurioItem
, the game will crash when trying to run multiplayer (only tested this within a development environment).Expected Behavior: The game in multiplayer not crashing from this combination of code usage.
Steps to Reproduce:
Item
@Mod.EventBusSubscriber
(no parameters necessary)ICurioItem
java.lang.RuntimeException: Attempted to load class com/mojang/blaze3d/matrix/MatrixStack for invalid dist DEDICATED_SERVER
Crash Log: https://pastebin.com/ZqdcUwUp
This issue was narrowed down to seemingly being caused by Curios from the debug log (https://pastebin.com/1dmB6Vvd) showing the run failing when trying to load the automatic subscriber for
IcePendantItem
. Removing the@Mod.EventBusSubscriber
annotation made the class work just fine afterwards with no crashes. When trying to troubleshoot this I was told this may be caused byICurioItem.render()
not being annotated with@OnlyIn(Side.CLIENT)
, but you would probably know better what the cause of the issue could be here.The text was updated successfully, but these errors were encountered: