Skip to content

Missing amount in display_fluid of example datapack #4

@Prunoideae

Description

@Prunoideae

"display_fluid": {
"fluid": "minecraft:water"
}

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

FluidStack.CODEC.fieldOf("display_fluid").orElse(new FluidStack(Fluids.WATER, 1000)).forGetter(recipe -> recipe.displayFluid),

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions