Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.16.5] Creating a packet


ImNotJahan
 Share

Recommended Posts

So I'm following the SimpleImpl forge docs (https://mcforge.readthedocs.io/en/1.16.x/networking/simpleimpl/), and I'm just on registering packets and I've run into the problem that I don't actually know how to make a packet. In the past I know there were things like IMessage & IMessageHandler, I can't find anything like that for 1.16.5 though. Also the register method for SimpleChannel requires a MSG, which I know is the packet but I can't find any definition for a class or anything named MSG either.

Link to comment
Share on other sites

You just make a class. Then you define:

  • an encoder: takes in the packet instance and a PacketBuffer and writes the packet's data to the buffer
  • a decoder: takes in a PacketBuffer, reads the packet data and then returns the packet instance
  • a handler: takes in the packet instance and performs its action.

You can choose your implementation however you like, you only need to provide these three elements.

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.