-
-
Notifications
You must be signed in to change notification settings - Fork 238
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
Using Protocols #162
Comments
Pretty close now !
They are almost generic so it wouldn't be too hard to put them into Protocols. client.js is almost generic too but I don't think it really fits into Protocols, we probably need to do finish #176 first. Got to think about better defining the scope of Protocols too. |
Todo list of changes for dataTypes :
|
countType done |
So we talked and switch cover all that condition does and it's more clean, so better replace condition by switch (see https://github.com/roblabla/Protocols/blob/master/lib/datatypes/conditional.js#L17 ) |
That's the kind of thing that should be fixed by the last point, this is caused by a write, but no idea which one :
|
Using longjohn is not much better :
line 9 of log.js :
with :
and So basically longjohn tell us : "the error comes from the on("error")" , not quite useful. (the problem is knowing which write this error is coming from) |
That's the error when you try to write a packet with a packet name that doesn't exist, it should be way clearer :
|
All changes we talked about here are done. |
string isn't done. cstring is different from string in that cstring is a value-delimited string, whereas string is a length-prefixed string. Not the same ;) |
@roblabla so why should string have a count/countType ? |
@rom1504 because minecraft here is the special case, prefixing string with a varint. Not every protocol format do use a varint as the prefix count |
ah right okay. |
In order to use Protocols I propose to create a branch in Protocols (possibly in a fork) containing NMP protocol.js, datatypes (not minecraft.js), test/dataTypes and a branch/PR in nmp using that Protocols branch. |
Okay I got myself needing "string should specify a count/countType like buffer and Array." Not sure if we want to name the generalized string "string", because we might want to keep calling a string a string in protocol.json (by extending the type) |
TBH, I'm ok with renaming every string "mcstring" in protocol.json. But if you think that's annoying maybe we can figure something out. |
I wonder how much stuff would break by doing |
@roblabla https://github.com/roblabla/ProtoDef/blob/master/src/protodef.js#L68 would break, we have a type map, not a type stack :p I don't know if we should rename the generalized string (lengthPrefixedString or something shorter) or the one used in nmp. lengthPrefixedString is way too long though. https://en.wikipedia.org/wiki/String_(computer_science)#Length-prefixed Apparently pstring might be a good name for it. |
pstring is now implemented in ProtoDef. Only thing remaining here is fixing the last issues of #274 and merging. |
So this issue is done now :) |
#159 and #161 brought node-minecraft-protocol much closer of https://github.com/roblabla/Protocols
It would be nice to actually use Protocols.
In order to do that, what's missing is mainly figuring out what to put into Protocols's stream.js to handle all the various kind of parse* there is in protocol.js and client.js.
Once that's done it would be possible to simply adding Protocols as a dependency and use it.
EDIT by @roblabla :
Protocol improvements I can't live without :
this
scheme. Instead, usesuper
androot
schemeThe text was updated successfully, but these errors were encountered: