Posted February 23, 20223 yr I've been following this doc (https://mcforge.readthedocs.io/en/latest/networking/simpleimpl/) but I don't see how the INSTANCE encodes the message how should know how to decode the message? and also does the MessageClass packet need to implement something or does it just send the Object of a class as the message?
February 23, 20223 yr the message class needs only three static methods: encode with parameters: a message and a FriendlyByteBuf decode with parameters: FriendlyByteBuf, and returns an instance of your message handle with parameters: a message and a Supplier with NetworkEvent.Context when registering your message to a SimpleChannel you must provide these three methods (via a BiConsumer for encode, a Function for decode and a BiConsumer for handle) you can take a look at this doc for about how to register messages
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.