mojira.dev
MC-252814

The `clamp` density function takes a direct input and doesn't allow a reference

The "clamp" density function type has an "input" field. But it only allows a direct (inlined) density function or a constant, it doesn't allow a reference (string). This is inconsistent with every other density function that takes another density function as argument.

The reason is because DensityFunctions.Clamp uses DensityFunction.DIRECT_CODEC, instead of DensityFunctions.HOLDER_HELPER_CODEC, which is what every other density function type uses.

Comments 1

This affects 1.21.11, the clamp density function codec is defined as:

euj.c.fieldOf("input")

meaning it uses the direct density function codec for input, unlike other density functions which use the holder codec helper. This prevents "input" from accepting string references such as "minecraft:overworld/caves/spaghetti_roughness_function".


    from: 1.21.11.jar:euk$g.class */
    protected static final class g extends Record implements q {
        private final euj b;
        private final double f;
        private final double g;
        private static final MapCodec<g> h = RecordCodecBuilder.mapCodec($$0 -> {
            return $$0.group(euj.c.fieldOf("input").forGetter((v0) -> {
                return v0.aG_();
            }), euk.d.fieldOf("min").forGetter((v0) -> {
                return v0.a();
            }), euk.d.fieldOf("max").forGetter((v0) -> {
                return v0.b();
            })).apply($$0, (v1, v2, v3) -> {
                return new g(v1, v2, v3);
            });

Misode

(Unassigned)

Community Consensus

Platform

Low

Custom Worlds

1.19, 1.19.2, 1.19.3 Release Candidate 1, 1.20.4, 23w51b, 1.20.6, 1.21.1, 24w40a

26.2 Snapshot 1

Retrieved