Forgive me if this is the wrong section.
Every so often (I want to say maybe 10-20% of attempts), when I try to load my test world, the game crashes with a ClassCastException related to client/server handshakes. I'm not sure what causes it exactly, but if I reload the world after the crash the player is back at the world spawn with their inventory wiped. The error only started once I updated my codebase to 1.12, leading me to believe that it's related to the new registry system.
Crash log: https://pastebin.com/SWCzxnkL
Thank you in advance for helping me fix, or at least understand, the problem.
EDIT: I just tried running the mod in an actual MC client instead of a development environment, and it doesn't seem to happen. However, since the error is random in nature it's entirely possible that I just got lucky.