Skip to content
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

versionsByProtocolVersion index (complement versionsByMinecraftVersion index for protocolVersions lookup) #15

Closed
deathcap opened this issue Jan 26, 2016 · 3 comments

Comments

@deathcap
Copy link
Member

f01605f added protocolVersions support with the versions array and versionsByMinecraftVersion index, but looking up the version data by a protocol version would be useful in some situations. Note that since protocol version has two namespaces (usesNetty: true and usesNetty: false), there is protocol version overlap, but this could be solved by using negative integers for usesNetty: false and usesNetty: true.

Proposed use case: related ot PrismarineJS/node-minecraft-protocol#330 Intra-release multi-protocol support. In node-minecraft-protocol, could allow the version options to be either:

  • typeof version === 'integer': use a version by protocol version integer (versionsByProtocolVersion index)
  • typeof version === 'string': use a version by minecraft release version string (versionsByMinecraftVersion index)

Both indexes would allow looking up majorVersion to map to the minecraft-data 'dataset' (1.8, 1.9...). The Minecraft release version string is more human-readable, suitable for custom client/app development, and the protocol version integer is more programmatically useful for automatically passing from the ping packet for PrismarineJS/node-minecraft-protocol#331 dynamic cross-protocol support.

This index could be used in #13 Update to use minecraft-data for toMajor(), so these would be equivalent:

   require('minecraft-data')('1.8.9')
   require('minecraft-data')(47)

(but accessing these indexes may require #14 Lookup protocol data at top-level of module?)

@rom1504
Copy link
Member

rom1504 commented Jan 26, 2016

I actually did that before commiting f01605f but then I noticed that there are multiple versions for a single protocol version (for example 47 has lot of versions), which one should we return ? all of them ?
About pre/post netty, I was thinking about just separating that index in two (preNettyVersionsByProtocolVersion and postNettyVersionsByProtocolVersion), a bit like what's been done for mobs and objects.

@rom1504
Copy link
Member

rom1504 commented Jan 26, 2016

I'm going to return all corresponding versions. For toMajor, I guess I'll just pick the first one. Currently the mapping protocolVersion -> majorVersion is unique anyway.

@rom1504
Copy link
Member

rom1504 commented Jan 26, 2016

Released as 0.19.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants