PrismarineJS / node-minecraft-protocol

Parse and serialize minecraft packets, plus authentication and encryption.
https://prismarinejs.github.io/node-minecraft-protocol/
BSD 3-Clause "New" or "Revised" License
1.2k stars 241 forks source link

Add generated protocol types #1280

Closed zardoy closed 4 months ago

zardoy commented 5 months ago

Add intellisense for packets:

Unfortunately in TS no way to display optionality or jsdoc for overloaded methods, its only possible with js proxied objects.

Alternatively, data can be generated in minecraft-data and reused here as type.

If everything is ok, I'll add the same for events (receive from server data)

rom1504 commented 4 months ago

thanks for the pr; but as said in comments this should live in node-protodef and be more generic

node-minecraft-protocol relies on node-protodef for the definition and implementation of its serialization functions

zardoy commented 4 months ago

I'm really interested in this. I do hope to not forget to do this, The last time I looked at it I realized I need more time to implement it there... for now I will just use generated files: https://github.com/zardoy/prismarine-web-client/blob/d36bec02bfb7222ef8ea1b0503371bf16812a9e2/src/generatedServerPackets.ts its really handy