Skip to content

Commit

Permalink
fix: Fix warp plate recipe fromNetwork mismatch #763
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Dec 11, 2023
1 parent 4e6a058 commit 924e361
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ public Codec<WarpPlateRecipe> codec() {
public WarpPlateRecipe fromNetwork(FriendlyByteBuf buf) {
final var resultItem = buf.readItem();
final var primaryIngredient = Ingredient.fromNetwork(buf);
final NonNullList<Ingredient> secondaryIngredients = NonNullList.createWithCapacity(4);
for (int i = 0; i < secondaryIngredients.size(); i++) {
final var secondaryCount = buf.readVarInt();
final NonNullList<Ingredient> secondaryIngredients = NonNullList.createWithCapacity(secondaryCount);
for (int i = 0; i < secondaryCount; i++) {
secondaryIngredients.add(Ingredient.fromNetwork(buf));
}
return new WarpPlateRecipe(resultItem, primaryIngredient, secondaryIngredients);
Expand All @@ -135,6 +136,7 @@ public WarpPlateRecipe fromNetwork(FriendlyByteBuf buf) {
public void toNetwork(FriendlyByteBuf buf, WarpPlateRecipe recipe) {
buf.writeItem(recipe.resultItem);
recipe.primaryIngredient.toNetwork(buf);
buf.writeVarInt(recipe.secondaryIngredients.size());
for (Ingredient ingredient : recipe.secondaryIngredients) {
ingredient.toNetwork(buf);
}
Expand Down

0 comments on commit 924e361

Please sign in to comment.