-
Notifications
You must be signed in to change notification settings - Fork 37
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
Implement reading and writing boolean values #555
Conversation
Mcstatus probably isn't the place to introduce these kinds of changes, as you're not expected to use these classes in your code. These classes are considered internal, and they are not a part of the public API. This means they're only expected to be used for internal functionalities, and if they're not necessary for those, they're not needed. If you do need this kind of change, either implement it locally within your project, or consider checking out https://github.com/py-mine/mcproto, which already supports this behavior, and where the reader/writer classes are indeed a part of the public API: see the implementation (enum def, writer and reader). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm looking forward to the forgeData
PR!
I agree with ItsDrike: before merging this PR, you need to explain why we even need this, as From this comment, I can see how you use the We must be confident that we will even use the code in this PR, so you need to explain how you will use it. Currently, could you explain please what is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test changes are a requirement for new features. I concur with the other reviews too. We need to see examples of how this internal function would be used and I suggest that tests are a good way of doing that.
CoolCat467 already sent a link to an example of where this is useful in #556. However our internal API doesn't need it, and we don't expect others to use the (Here's the link to that example from the issue: https://github.com/CoolCat467/StatusBot/blob/main/src/StatusBot/decode_mods.py, it seems that forgeData dict holds some data under "d" key, which is a string in JSON, however it essentially just represents binary data, and the buffer/connection reader/writer classes are indeed necessary to read it). I wouldn't mind adding this, but again, only if we agree to also add a parser for the forgeData, since otherwise this doesn't really serve us any purpose considering it wouldn't be used internally, and we don't expect it to be used externally. |
Basically, the More information is available in the docstrings in this file from forge itself: https://github.com/MinecraftForge/MinecraftForge/blob/42115d37d6a46856e3dc914b54a1ce6d33b9872a/src/main/java/net/minecraftforge/network/ServerStatusPing.java Basically I need the ability to read boolean values because the compressed response contains boolean values. Then we could make a forgeData parser so to speak, but it wouldn't really be parsing just decoding the compressed response if the server has it. For older versions of forge, it just put all the data in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use squash
strategy for this PR? As the commit history is not really clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be merged, but only assuming we will later actually add support for showing forgeData
. Currently, this will just add an unused method into Connection classes, and since they aren't officially a part of the public API, meaning we don't expect people to use these directly, it doesn't make sense to have it here without actually using it internally.
If this will come with another PR, adding public support for reading forgeData
, this can be merged,
Yes, I plan to add a forgeData reader, but I would love to hear feedback about where the interface should be. |
Inside |
Or if you are about where to put the parsing logic, I can send you an example of how I imagine this architecture in Discord. |
I know nothing in preforming server pings uses boolean values, but this would be super handy to have for handling responses with the
forgeData
section