minecraft-protocol icon indicating copy to clipboard operation
minecraft-protocol copied to clipboard

Add missing derives, `favicon` field and new `Packet` struct.

Open reitermarkus opened this issue 4 years ago • 5 comments

  • Derive Debug for every struct.
  • Add missing favicon field for ServerStatus.
  • Add Packet struct to decode full packets.

reitermarkus avatar Dec 07 '21 19:12 reitermarkus

Do you have an example for how this works?

I've bodged together packet reading/writing with compression support here:

https://github.com/timvisee/lazymc/blob/0c69752fecdc4ad95d2c5c96c3fd37f72ea11d70/src/proto/packet.rs#L18-L235

My implementation handles compression, but no encryption though.

In the login stage, the server may send a SetCompression(n) packet after which compression should be enabled if the packet payload is >= n bytes.

Read more about compression here: https://wiki.vg/Protocol#Packet_format

timvisee avatar Dec 15 '21 14:12 timvisee

Thanks @timvisee, I will have a look, your “Lobby” feature looks very interesting.

For my use case (a Kubernetes game server proxy for auto-scaling, pretty similar to your lazymc project actually) I didn't need compression/encryption support since the only thing I need to know is whether a login packet has been received, after that everything else is forwarded as is to the upstream server.

reitermarkus avatar Dec 16 '21 11:12 reitermarkus

Okay, looking at @timvisee's implementation, this Packet struct with its Decoder implementation could replace the read_packet_id_data function. Maybe calling it UncompressedPacket makes more sense then?

reitermarkus avatar Dec 17 '21 09:12 reitermarkus

Okay, I renamed the Packet to RawPacket and also added structs for CompressedRawPacket and UncompressedRawPacket to support both compressed and uncompressed packets.

reitermarkus avatar Dec 17 '21 11:12 reitermarkus

@vaIgarashi, can you have another look?

reitermarkus avatar Jan 31 '22 07:01 reitermarkus