Posted October 29, 20205 yr 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?
October 29, 20205 yr 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, 20205 yr by urbanxx001
October 29, 20205 yr 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, 20205 yr by urbanxx001
October 29, 20205 yr Author Ah okay I see how the buffer works now. Thanks! So it should look something like this: Edited October 29, 20205 yr by skip999
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.