skip999 Posted October 29, 2020 Share Posted October 29, 2020 Hello, 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? Quote Link to comment Share on other sites More sharing options...
urbanxx001 Posted October 29, 2020 Share Posted October 29, 2020 (edited) 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 October 29, 2020 by urbanxx001 Quote Link to comment Share on other sites More sharing options...
skip999 Posted October 29, 2020 Author Share Posted October 29, 2020 I did the write method like so: Quote Link to comment Share on other sites More sharing options...
urbanxx001 Posted October 29, 2020 Share Posted October 29, 2020 (edited) That looks right. You can test it and see if everything is functioning correctly. There might also be a way to read/write the ingredients as a single array, but it would be the same amount of code. Edited October 29, 2020 by urbanxx001 Quote Link to comment Share on other sites More sharing options...
skip999 Posted October 29, 2020 Author Share Posted October 29, 2020 (edited) Ah okay I see how the buffer works now. Thanks! So it should look something like this: Edited October 29, 2020 by skip999 Quote Link to comment Share on other sites More sharing options...
skip999 Posted October 29, 2020 Author Share Posted October 29, 2020 Okay so its a first in first out structure good to know! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.