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

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

public class EndGatewayPlacementDecorator extends FeatureDecorator<NoneDecoratorConfiguration> {
    public EndGatewayPlacementDecorator(final Codec<NoneDecoratorConfiguration> codec) {
        super(codec);
    }
    
    @Override
    public Stream<BlockPos> getPositions(final LevelAccessor bqc, final ChunkGenerator cha, final Random random, final NoneDecoratorConfiguration cnz, final BlockPos fu) {
        if (random.nextInt(700) == 0) {
            final int integer7 = random.nextInt(16) + fu.getX();
            final int integer8 = random.nextInt(16) + fu.getZ();
            final int integer9 = bqc.getHeight(Heightmap.Types.MOTION_BLOCKING, integer7, integer8);
            if (integer9 > 0) {
                final int integer10 = integer9 + 3 + random.nextInt(7);
                return Stream.<BlockPos>of(new BlockPos(integer7, integer10, integer8));
            }
        }
        return Stream.<BlockPos>empty();
    }
}
