przemykomo / simple-planes

Planes mod for minecraft forge.
GNU Lesser General Public License v3.0
28 stars 26 forks source link

register data serializers with Forge #17

Closed TheWhoAreYouPerson closed 4 years ago

TheWhoAreYouPerson commented 4 years ago

fixes some netty DecoderExceptions, particularly the "connection lost" messages some of my clients have been getting:

Internal Exception: io.netty.handler.codec.DecoderException: Unknown serializer type 25 and Internal Exception: io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: readerIndex(108) + length(8) exceeds writerIndex(114): PooledUnsafeDirectByteIndex(ridx: 108, widx: 114, cap: 114)

This fixes the issues I described in #16

While poking around in the code I noticed that the Quaternion data serializer was registered to Minecraft, but not Forge. My guess as to the reason it works for ~1/2 of my server clients as-is (without this patch) involves some sort of race condition with multiple mods being loaded at once, fighting for DataSerializer IDs. (based off the 'Unknown Serializer Type' error that sometimes shows when a player disconnects)

I haven't done much modding in a while. I made this patch based off of info from https://mcforge.readthedocs.io/en/latest/concepts/registries/ and the warning in https://mcforge.readthedocs.io/en/latest/networking/entities/#data-parameters was particularly helpful in diagnosing the issue.

Please let me know if there is anything more I should change (I tried to match the existing structure and coding style), and if not, please give me a shout when this patch lands on Curseforge :) Until then my server will be running a custom compiled version so all can play with planes!

przemykomo commented 4 years ago

Just checked it and it seems to work. I'm going to merge this tommorow and hopefully new version will be on curseforge this week.

przemykomo commented 4 years ago

Thanks for helping out.