Jump to content

Reading multiple input items from a PacketBuffer


Recommended Posts


I have been working on implementing a custom furnace block in forge 1.15.2. I have run into a slight snag that I cannot seem to figure out however. For reference, my block will take two inputs and produce 1 output. I have been able to figure out everything but how to set up the serializer properly. Specifically, in the Serializer class's read method, how would I read from the PacketBuffer if I have more than one input. I cannot seem to find any information on this. I have included my best guess at the correct approach. Am I on the right track?



Link to comment
Share on other sites

Reading those variables entirely depends on how you created the write() method. For reference, the vanilla classes such as CookingRecipeSerializer are a good template. The only difference is they return the recipe from factory:

return this.factory.create(recipeId, etc.)

If you have variables such as cooking time and experience returned, they should also be written and read.

Edited by urbanxx001
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.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.