JDKDigital / treetap

Other
1 stars 3 forks source link

Missing `amount` in `display_fluid` of example datapack #4

Open Prunoideae opened 3 months ago

Prunoideae commented 3 months ago

https://github.com/JDKDigital/treetap/blob/17ae9a34ec0d50d0dc95937bc966538367f99dcb/src/main/resources/data/treetap/recipe/water_from_crying_obsidian.json#L11-L13

Is missing an amount field since display_fluid is serialized as a FluidStack:

https://github.com/JDKDigital/treetap/blob/17ae9a34ec0d50d0dc95937bc966538367f99dcb/src/main/java/cy/jdkdigital/treetap/common/block/recipe/TapExtractRecipe.java#L93

Since amount in FluidStack is now required:

    public static final Codec<FluidStack> CODEC = Codec.lazyInitialized(
            () -> RecordCodecBuilder.create(
                    instance -> instance.group(
                            FLUID_NON_EMPTY_CODEC.fieldOf("id").forGetter(FluidStack::getFluidHolder),
                            ExtraCodecs.POSITIVE_INT.fieldOf("amount").forGetter(FluidStack::getAmount), // note: no .orElse(1) compared to ItemStack
                            DataComponentPatch.CODEC.optionalFieldOf("components", DataComponentPatch.EMPTY)
                                    .forGetter(stack -> stack.components.asPatch()))
                            .apply(instance, FluidStack::new)));

This will cause deserialization error when adding recipe support for KubeJS:

image