package net.minecraft.world.level.levelgen.placement;

import net.minecraft.world.level.levelgen.feature.configurations.DecoratorConfiguration;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import java.util.Random;
import com.mojang.serialization.Codec;

public class ChancePassthroughDecorator extends SimpleFeatureDecorator<ChanceDecoratorConfiguration> {
    public ChancePassthroughDecorator(final Codec<ChanceDecoratorConfiguration> codec) {
        super(codec);
    }
    
    public Stream<BlockPos> place(final Random random, final ChanceDecoratorConfiguration crf, final BlockPos fu) {
        if (random.nextFloat() < 1.0f / crf.chance) {
            return Stream.<BlockPos>of(fu);
        }
        return Stream.<BlockPos>empty();
    }
}
