package net.minecraft.world.level.levelgen.feature.configurations;

import com.mojang.datafixers.kinds.Applicative;
import com.mojang.datafixers.kinds.App;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.mojang.serialization.Codec;

public class ChanceRangeDecoratorConfiguration implements DecoratorConfiguration {
    public static final Codec<ChanceRangeDecoratorConfiguration> CODEC;
    public final float chance;
    public final int bottomOffset;
    public final int topOffset;
    public final int top;
    
    public ChanceRangeDecoratorConfiguration(final float float1, final int integer2, final int integer3, final int integer4) {
        this.chance = float1;
        this.bottomOffset = integer2;
        this.topOffset = integer3;
        this.top = integer4;
    }
    
    static {
        CODEC = RecordCodecBuilder.create(instance -> ((RecordCodecBuilder.Instance)instance).group((App)Codec.FLOAT.fieldOf("chance").forGetter(cni -> cni.chance), (App)Codec.INT.fieldOf("bottom_offset").withDefault(0).forGetter(cni -> cni.bottomOffset), (App)Codec.INT.fieldOf("top_offset").withDefault(0).forGetter(cni -> cni.topOffset), (App)Codec.INT.fieldOf("top").withDefault(0).forGetter(cni -> cni.top)).apply(instance, ChanceRangeDecoratorConfiguration::new));
    }
}
