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

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;
import net.minecraft.world.level.levelgen.feature.configurations.ChanceRangeDecoratorConfiguration;
import net.minecraft.world.level.levelgen.placement.SimpleFeatureDecorator;

public class ChanceRangeDecorator extends SimpleFeatureDecorator<ChanceRangeDecoratorConfiguration> {
    public ChanceRangeDecorator(final Codec<ChanceRangeDecoratorConfiguration> codec) {
        super(codec);
    }
    
    public Stream<BlockPos> place(final Random random, final ChanceRangeDecoratorConfiguration cni, final BlockPos fu) {
        if (random.nextFloat() < cni.chance) {
            final int integer5 = random.nextInt(16) + fu.getX();
            final int integer6 = random.nextInt(16) + fu.getZ();
            final int integer7 = random.nextInt(cni.top - cni.topOffset) + cni.bottomOffset;
            return Stream.<BlockPos>of(new BlockPos(integer5, integer7, integer6));
        }
        return Stream.<BlockPos>empty();
    }
}
