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

import java.util.stream.Collectors;
import java.util.Arrays;
import java.util.function.Function;
import javax.annotation.Nullable;
import java.util.Map;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
import java.util.Random;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
import net.minecraft.world.level.chunk.ChunkGenerator;
import com.mojang.serialization.Codec;
import net.minecraft.world.level.levelgen.feature.configurations.OceanRuinConfiguration;
import net.minecraft.world.level.levelgen.feature.StructureFeature;

public class OceanRuinFeature extends StructureFeature<OceanRuinConfiguration> {
    public OceanRuinFeature(final Codec<OceanRuinConfiguration> codec) {
        super(codec);
    }
    
    @Override
    public StructureStartFactory<OceanRuinConfiguration> getStartFactory() {
        return OceanRuinStart::new;
    }
    
    public static class OceanRuinStart extends StructureStart<OceanRuinConfiguration> {
        public OceanRuinStart(final StructureFeature<OceanRuinConfiguration> cml, final int integer2, final int integer3, final BoundingBox ctd, final int integer5, final long long6) {
            super(cml, integer2, integer3, ctd, integer5, long6);
        }
        
        @Override
        public void generatePieces(final ChunkGenerator cha, final StructureManager cva, final int integer3, final int integer4, final Biome bre, final OceanRuinConfiguration cob) {
            final int integer5 = integer3 * 16;
            final int integer6 = integer4 * 16;
            final BlockPos fu10 = new BlockPos(integer5, 90, integer6);
            final Rotation cap11 = Rotation.getRandom(this.random);
            OceanRuinPieces.addPieces(cva, fu10, cap11, this.pieces, this.random, cob);
            this.calculateBoundingBox();
        }
    }
    
    public enum Type implements StringRepresentable {
        WARM("warm"), 
        COLD("cold");
        
        public static final Codec<Type> CODEC;
        private static final Map<String, Type> BY_NAME;
        private final String name;
        
        private Type(final String string3) {
            this.name = string3;
        }
        
        public String getName() {
            return this.name;
        }
        
        @Nullable
        public static Type byName(final String string) {
            return Type.BY_NAME.get(string);
        }
        
        @Override
        public String getSerializedName() {
            return this.name;
        }
        
        static {
            CODEC = StringRepresentable.<Type>fromEnum(Type::values, Type::byName);
            BY_NAME = Arrays.<Type>stream(values()).collect(Collectors.toMap(Type::getName, b -> b));
        }
    }
}
