Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing amount in display_fluid of example datapack #4

Open
Prunoideae opened this issue Aug 5, 2024 · 0 comments
Open

Missing amount in display_fluid of example datapack #4

Prunoideae opened this issue Aug 5, 2024 · 0 comments

Comments

@Prunoideae
Copy link

"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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant