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.datafixers.Dynamic;
import java.util.function.Function;

public class ChancePassthroughDecorator extends SimpleFeatureDecorator<ChanceDecoratorConfiguration> {
    public ChancePassthroughDecorator(final Function<Dynamic<?>, ? extends ChanceDecoratorConfiguration> function) {
        super(function);
    }
    
    public Stream<BlockPos> place(final Random random, final ChanceDecoratorConfiguration cjd, final BlockPos fk) {
        if (random.nextFloat() < 1.0f / cjd.chance) {
            return Stream.<BlockPos>of(fk);
        }
        return Stream.<BlockPos>empty();
    }
}
