-
-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First version of NetworkCodec #819
base: master
Are you sure you want to change the base?
Conversation
The goal is to move all custom data types such as Knownpack to migrate to NetworkCodec in the future. Right now only KnownPack uses this system. Follow-up PRs will implement this system for other data types as well as move some simple data types from the codechelper classes to NetworkCodec. |
This PR, if merged, will define how future classes are set to encode/decode. Pistonmaster, please do note down for the record on GitHub why you think MCPL should move to a Codec system. I will try to get more input on this. |
The main reason for NetworkCodec is to debloat the MinecraftCodecHelper class. It has proven itself to not be a future-proof approach for serializing Minecraft data structures. Using a dedicated codec helper class has added way too many methods into a single class and it's hard to just find the serialization methods associated with a data structure. This NetworkCodec class follows Mojangs approach of moving from a centralized serialization class to the class itself to contain everything inside it that is needed to serialize it. |
I can see the merit in moving serialisation within the data classes, but for that I'd prefer to stick to our current format with a read and a write function, largely just because I don't see any benefits of using a network codec to surround the same code that was going to be there in the first place. |
Well I've given benefits of this approach above. Additionally differences in the read/write implementation are far easier to see because they are right next to each other and there is no surrounding code that may distract readers. But if you'd like to see json codecs first and then come back to network codecs then fine I can wait, but I'll leave this PR open and come back once json codecs are in use. |
Here is an example codebase that makes full use if this concept: |
Given that this is a concept, ill mark this as a draft |
This PR is ready for review. I'm not adding Json Codecs and only NetworkCodec. |
The reason why is that I not longer need json Codecs however I still need/want this. |
No description provided.