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

import net.minecraft.world.level.levelgen.feature.configurations.DecoratorConfiguration;
import java.util.stream.IntStream;
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.CountRangeDecoratorConfiguration;
import net.minecraft.world.level.levelgen.placement.SimpleFeatureDecorator;

public class RandomCountRangeDecorator extends SimpleFeatureDecorator<CountRangeDecoratorConfiguration> {
    public RandomCountRangeDecorator(final Codec<CountRangeDecoratorConfiguration> codec) {
        super(codec);
    }
    
    public Stream<BlockPos> place(final Random random, final CountRangeDecoratorConfiguration cnl, final BlockPos fu) {
        final int integer5 = random.nextInt(Math.max(cnl.count, 1));
        final int integer6;
        final int integer7;
        final int integer8;
        return IntStream.range(0, integer5).<BlockPos>mapToObj(integer -> {
            integer6 = random.nextInt(16) + fu.getX();
            integer7 = random.nextInt(16) + fu.getZ();
            integer8 = random.nextInt(cnl.maximum - cnl.topOffset) + cnl.bottomOffset;
            return new BlockPos(integer6, integer8, integer7);
        });
    }
}
