3 ms·
Here's some old code of mine: https://github.com/vatt849/LibMinecraft/blob/master/LibMinecraft/Client/MultiplayerClient.cs https://github.com/vatt849/LibMinecr
by Sir_Cmpwn 7y ago
Here's some old code of mine:
https://github.com/vatt849/LibMinecraft/blob/master/LibMinecraft/Client/MultiplayerClient.cs https://github.com/vatt849/LibMinecraft/blob/master/LibMinec...
The whole library is a trip if you want to read a bunch of bad C#. Highlights:
- Generated documentation
- Giant switch/case instead of a more organized dispatch map
- Large swaths of commented code instead of using version control
- try...catch statements that just eat the errors
- Inconsistent code style
- This thing:
https://github.com/vatt849/LibMinecraft/blob/master/LibMinecraft/Client/MultiplayerClient.cs#L603-L621 https://github.com/vatt849/LibMinecraft/blob/master/LibMinec...
I've written something similar from scratch since, which I'm still not entirely satisfied with, but is much better for reference:
https://github.com/ddevault/TrueCraft https://github.com/ddevault/TrueCraft
The client-side networking code lives here:
https://github.com/ddevault/TrueCraft/blob/master/TrueCraft.Core/Networking/PacketReader.cs https://github.com/ddevault/TrueCraft/blob/master/TrueCraft....
https://github.com/ddevault/TrueCraft/blob/master/TrueCraft.Client/MultiplayerClient.cs https://github.com/ddevault/TrueCraft/blob/master/TrueCraft....
https://github.com/ddevault/TrueCraft/tree/master/TrueCraft.Client/Handlers https://github.com/ddevault/TrueCraft/tree/master/TrueCraft....
Notable improvements:
- Handwritten docs only where necessary
- Uses a stream implementation for decoding this particular wire format
- Has a different and better abstraction for reading packets out
Still has bad error handling though.