From bb84d539060be12522ccbc5c566c0187338cbef7 Mon Sep 17 00:00:00 2001 From: Mrbysco Date: Sun, 11 Aug 2024 20:33:08 +0200 Subject: [PATCH] Fixed wrong Codec / StreamCodec being used for Crushing recipe --- .../actuallyadditions/mod/crafting/CrushingRecipe.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrushingRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrushingRecipe.java index 9e4236820..e1cbe4d05 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrushingRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrushingRecipe.java @@ -110,7 +110,7 @@ public class CrushingRecipe implements Recipe { public static class Serializer implements RecipeSerializer { private static final Codec RESULT_CODEC = RecordCodecBuilder.create( instance -> instance.group( - ItemStack.CODEC.fieldOf("result").forGetter(result -> result.stack), + ItemStack.OPTIONAL_CODEC.fieldOf("result").forGetter(result -> result.stack), Codec.FLOAT.optionalFieldOf("chance", 1.0F).forGetter(recipe -> recipe.chance) ) .apply(instance, CrushingResult::new) @@ -190,7 +190,7 @@ public class CrushingRecipe implements Recipe { NonNullList nonnulllist = NonNullList.withSize(i, CrushingResult.EMPTY); for (int j = 0; j < nonnulllist.size(); ++j) { - nonnulllist.set(j, new CrushingResult(ItemStack.STREAM_CODEC.decode(pBuffer), pBuffer.readFloat())); + nonnulllist.set(j, new CrushingResult(ItemStack.OPTIONAL_STREAM_CODEC.decode(pBuffer), pBuffer.readFloat())); } return new CrushingRecipe(ingredient, nonnulllist); @@ -200,7 +200,7 @@ public class CrushingRecipe implements Recipe { Ingredient.CONTENTS_STREAM_CODEC.encode(pBuffer, pRecipe.input); pBuffer.writeVarInt(pRecipe.outputs.size()); for (CrushingResult result : pRecipe.outputs) { - ItemStack.STREAM_CODEC.encode(pBuffer, result.stack); + ItemStack.OPTIONAL_STREAM_CODEC.encode(pBuffer, result.stack); pBuffer.writeFloat(result.chance); } }