Skip to content

Commit

Permalink
fix codecs for CoffeeRecipe
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMCLoveMan committed Jun 15, 2024
1 parent 62ff05f commit ae9d17b
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public static class Serializer implements RecipeSerializer<CoffeeRecipe> {
SizedFluidIngredient.FLAT_CODEC.optionalFieldOf("milk").forGetter(recipe -> recipe.milkIngredient),
ItemStack.SINGLE_ITEM_CODEC.fieldOf("result").forGetter(recipe -> recipe.result),
Codec.INT.fieldOf("cookingtime").orElse(150).forGetter(recipe -> recipe.cookingTime)
).apply(instance, (group1, cupIngredient1, beanIngredient1, extraIngredient1, waterIngredient1, milkIngredient1, result1, cookingTime1) -> new CoffeeRecipe(group1, cupIngredient1, beanIngredient1, extraIngredient1, waterIngredient1, milkIngredient1, result1, cookingTime1)));
).apply(instance, CoffeeRecipe::new));

private static final StreamCodec<RegistryFriendlyByteBuf, CoffeeRecipe> STREAM_CODEC = StreamCodec.of(Serializer::toNetwork, Serializer::fromNetwork);

Expand Down Expand Up @@ -151,8 +151,8 @@ private static CoffeeRecipe fromNetwork(RegistryFriendlyByteBuf buffer) {
private static void toNetwork(RegistryFriendlyByteBuf buffer, CoffeeRecipe recipe) {
buffer.writeUtf(recipe.group);
Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, recipe.cupIngredient);
Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, recipe.cupIngredient);
Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, recipe.cupIngredient);
Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, recipe.beanIngredient);
Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, recipe.extraIngredient);
SizedFluidIngredient.STREAM_CODEC.encode(buffer, recipe.waterIngredient);

if (recipe.milkIngredient.isPresent()) {
Expand Down

0 comments on commit ae9d17b

Please sign in to comment.