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

import net.minecraft.Util;
import net.minecraft.world.level.levelgen.placement.ChanceDecoratorConfiguration;
import net.minecraft.world.level.levelgen.feature.configurations.BlockStateConfiguration;
import net.minecraft.world.level.levelgen.placement.ConfiguredDecorator;
import net.minecraft.world.level.levelgen.feature.configurations.DecoratorConfiguration;
import net.minecraft.world.level.levelgen.placement.FeatureDecorator;
import net.minecraft.world.level.levelgen.feature.Feature;
import org.apache.logging.log4j.LogManager;
import net.minecraft.world.level.levelgen.feature.configurations.ShipwreckConfiguration;
import net.minecraft.world.level.levelgen.feature.configurations.OceanRuinConfiguration;
import net.minecraft.world.level.levelgen.structure.OceanRuinFeature;
import net.minecraft.world.level.levelgen.feature.configurations.VillageConfiguration;
import net.minecraft.world.level.levelgen.feature.configurations.MineshaftConfiguration;
import net.minecraft.world.level.levelgen.feature.MineshaftFeature;
import java.util.HashMap;
import net.minecraft.util.Mth;
import net.minecraft.world.level.biome.Biomes;
import com.google.common.base.Splitter;
import java.util.Collection;
import net.minecraft.world.level.chunk.ChunkGeneratorType;
import java.util.stream.Collector;
import java.util.function.Function;
import java.util.stream.Collectors;
import com.mojang.datafixers.util.Pair;
import java.util.stream.Stream;
import com.google.common.collect.ImmutableMap;
import com.mojang.datafixers.Dynamic;
import com.mojang.datafixers.types.DynamicOps;
import java.util.Collections;
import java.util.Locale;
import java.util.Iterator;
import net.minecraft.world.level.block.Blocks;
import javax.annotation.Nullable;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import com.google.common.collect.Maps;
import com.google.common.collect.Lists;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.biome.Biome;
import java.util.List;
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
import net.minecraft.world.level.levelgen.GenerationStep;
import java.util.Map;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.level.levelgen.ChunkGeneratorSettings;

public class FlatLevelGeneratorSettings extends ChunkGeneratorSettings {
    private static final Logger LOGGER;
    private static final ConfiguredFeature<?, ?> MINESHAFT_COMPOSITE_FEATURE;
    private static final ConfiguredFeature<?, ?> VILLAGE_COMPOSITE_FEATURE;
    private static final ConfiguredFeature<?, ?> STRONGHOLD_COMPOSITE_FEATURE;
    private static final ConfiguredFeature<?, ?> SWAMPHUT_COMPOSITE_FEATURE;
    private static final ConfiguredFeature<?, ?> DESERT_PYRAMID_COMPOSITE_FEATURE;
    private static final ConfiguredFeature<?, ?> JUNGLE_PYRAMID_COMPOSITE_FEATURE;
    private static final ConfiguredFeature<?, ?> IGLOO_COMPOSITE_FEATURE;
    private static final ConfiguredFeature<?, ?> SHIPWRECK_COMPOSITE_FEATURE;
    private static final ConfiguredFeature<?, ?> OCEAN_MONUMENT_COMPOSITE_FEATURE;
    private static final ConfiguredFeature<?, ?> WATER_LAKE_COMPOSITE_FEATURE;
    private static final ConfiguredFeature<?, ?> LAVA_LAKE_COMPOSITE_FEATURE;
    private static final ConfiguredFeature<?, ?> ENDCITY_COMPOSITE_FEATURE;
    private static final ConfiguredFeature<?, ?> WOOLAND_MANSION_COMPOSITE_FEATURE;
    private static final ConfiguredFeature<?, ?> FORTRESS_COMPOSITE_FEATURE;
    private static final ConfiguredFeature<?, ?> OCEAN_RUIN_COMPOSITE_FEATURE;
    private static final ConfiguredFeature<?, ?> PILLAGER_OUTPOST_COMPOSITE_FEATURE;
    public static final Map<ConfiguredFeature<?, ?>, GenerationStep.Decoration> STRUCTURE_FEATURES_STEP;
    public static final Map<String, ConfiguredFeature<?, ?>[]> STRUCTURE_FEATURES;
    public static final Map<ConfiguredFeature<?, ?>, FeatureConfiguration> STRUCTURE_FEATURES_DEFAULT;
    private final List<FlatLayerInfo> layersInfo;
    private final Map<String, Map<String, String>> structuresOptions;
    private Biome biome;
    private final BlockState[] layers;
    private boolean voidGen;
    private int seaLevel;
    
    public FlatLevelGeneratorSettings() {
        this.layersInfo = Lists.newArrayList();
        this.structuresOptions = Maps.newHashMap();
        this.layers = new BlockState[256];
    }
    
    @Nullable
    public static Block byString(final String string) {
        try {
            final ResourceLocation sm2 = new ResourceLocation(string);
            return Registry.BLOCK.getOptional(sm2).orElse(null);
        }
        catch (IllegalArgumentException illegalArgumentException2) {
            FlatLevelGeneratorSettings.LOGGER.warn("Invalid blockstate: {}", string, illegalArgumentException2);
            return null;
        }
    }
    
    public Biome getBiome() {
        return this.biome;
    }
    
    public void setBiome(final Biome bkt) {
        this.biome = bkt;
    }
    
    public Map<String, Map<String, String>> getStructuresOptions() {
        return this.structuresOptions;
    }
    
    public List<FlatLayerInfo> getLayersInfo() {
        return this.layersInfo;
    }
    
    public void updateLayers() {
        int integer2 = 0;
        for (final FlatLayerInfo cix4 : this.layersInfo) {
            cix4.setStart(integer2);
            integer2 += cix4.getHeight();
        }
        this.seaLevel = 0;
        this.voidGen = true;
        integer2 = 0;
        for (final FlatLayerInfo cix4 : this.layersInfo) {
            for (int integer3 = cix4.getStart(); integer3 < cix4.getStart() + cix4.getHeight(); ++integer3) {
                final BlockState byj6 = cix4.getBlockState();
                if (byj6.getBlock() != Blocks.AIR) {
                    this.voidGen = false;
                    this.layers[integer3] = byj6;
                }
            }
            if (cix4.getBlockState().getBlock() == Blocks.AIR) {
                integer2 += cix4.getHeight();
            }
            else {
                this.seaLevel += cix4.getHeight() + integer2;
                integer2 = 0;
            }
        }
    }
    
    @Override
    public String toString() {
        final StringBuilder stringBuilder2 = new StringBuilder();
        for (int integer3 = 0; integer3 < this.layersInfo.size(); ++integer3) {
            if (integer3 > 0) {
                stringBuilder2.append(",");
            }
            stringBuilder2.append(this.layersInfo.get(integer3));
        }
        stringBuilder2.append(";");
        stringBuilder2.append(Registry.BIOME.getKey(this.biome));
        stringBuilder2.append(";");
        if (!this.structuresOptions.isEmpty()) {
            int integer3 = 0;
            for (final Map.Entry<String, Map<String, String>> entry5 : this.structuresOptions.entrySet()) {
                if (integer3++ > 0) {
                    stringBuilder2.append(",");
                }
                stringBuilder2.append(entry5.getKey().toLowerCase(Locale.ROOT));
                final Map<String, String> map6 = entry5.getValue();
                if (!map6.isEmpty()) {
                    stringBuilder2.append("(");
                    int integer4 = 0;
                    for (final Map.Entry<String, String> entry6 : map6.entrySet()) {
                        if (integer4++ > 0) {
                            stringBuilder2.append(" ");
                        }
                        stringBuilder2.append(entry6.getKey());
                        stringBuilder2.append("=");
                        stringBuilder2.append(entry6.getValue());
                    }
                    stringBuilder2.append(")");
                }
            }
        }
        return stringBuilder2.toString();
    }
    
    @Nullable
    private static FlatLayerInfo getLayerInfoFromString(final String string, final int integer) {
        final String[] arr3 = string.split("\\*", 2);
        int integer2 = 0;
        Label_0051: {
            if (arr3.length == 2) {
                try {
                    integer2 = Math.max(Integer.parseInt(arr3[0]), 0);
                    break Label_0051;
                }
                catch (NumberFormatException numberFormatException5) {
                    FlatLevelGeneratorSettings.LOGGER.error("Error while parsing flat world string => {}", numberFormatException5.getMessage());
                    return null;
                }
            }
            integer2 = 1;
        }
        final int integer3 = Math.min(integer + integer2, 256);
        final int integer4 = integer3 - integer;
        Block bph7;
        try {
            bph7 = byString(arr3[arr3.length - 1]);
        }
        catch (Exception exception8) {
            FlatLevelGeneratorSettings.LOGGER.error("Error while parsing flat world string => {}", exception8.getMessage());
            return null;
        }
        if (bph7 == null) {
            FlatLevelGeneratorSettings.LOGGER.error("Error while parsing flat world string => Unknown block, {}", arr3[arr3.length - 1]);
            return null;
        }
        final FlatLayerInfo cix8 = new FlatLayerInfo(integer4, bph7);
        cix8.setStart(integer);
        return cix8;
    }
    
    private static List<FlatLayerInfo> getLayersInfoFromString(final String string) {
        final List<FlatLayerInfo> list2 = Lists.newArrayList();
        final String[] arr3 = string.split(",");
        int integer4 = 0;
        for (final String string2 : arr3) {
            final FlatLayerInfo cix9 = getLayerInfoFromString(string2, integer4);
            if (cix9 == null) {
                return Collections.<FlatLayerInfo>emptyList();
            }
            list2.add(cix9);
            integer4 += cix9.getHeight();
        }
        return list2;
    }
    
    public <T> Dynamic<T> toObject(final DynamicOps<T> dynamicOps) {
        final T object3 = (T)dynamicOps.createList((Stream)this.layersInfo.stream().map(cix -> dynamicOps.createMap((Map)ImmutableMap.of(dynamicOps.createString("height"), dynamicOps.createInt(cix.getHeight()), dynamicOps.createString("block"), dynamicOps.createString(Registry.BLOCK.getKey(cix.getBlockState().getBlock()).toString())))));
        final T object4 = (T)dynamicOps.createMap((Map)this.structuresOptions.entrySet().stream().map(entry -> Pair.of(dynamicOps.createString(entry.getKey().toLowerCase(Locale.ROOT)), dynamicOps.createMap((Map)((Map)entry.getValue()).entrySet().stream().map(entry -> Pair.of(dynamicOps.createString((String)entry.getKey()), dynamicOps.createString((String)entry.getValue()))).collect(Collectors.toMap(Pair::getFirst, Pair::getSecond))))).collect(Collectors.toMap(Pair::getFirst, Pair::getSecond)));
        return (Dynamic<T>)new Dynamic((DynamicOps)dynamicOps, dynamicOps.createMap((Map)ImmutableMap.of(dynamicOps.createString("layers"), object3, dynamicOps.createString("biome"), dynamicOps.createString(Registry.BIOME.getKey(this.biome).toString()), dynamicOps.createString("structures"), object4)));
    }
    
    public static FlatLevelGeneratorSettings fromObject(final Dynamic<?> dynamic) {
        final FlatLevelGeneratorSettings ciy2 = ChunkGeneratorType.FLAT.createSettings();
        final List<Pair<Integer, Block>> list3 = (List<Pair<Integer, Block>>)dynamic.get("layers").asList(dynamic -> Pair.of(dynamic.get("height").asInt(1), byString(dynamic.get("block").asString(""))));
        if (list3.stream().anyMatch(pair -> pair.getSecond() == null)) {
            return getDefault();
        }
        final List<FlatLayerInfo> list4 = list3.stream().map(pair -> new FlatLayerInfo((int)pair.getFirst(), (Block)pair.getSecond())).collect(Collectors.toList());
        if (list4.isEmpty()) {
            return getDefault();
        }
        ciy2.getLayersInfo().addAll(list4);
        ciy2.updateLayers();
        ciy2.setBiome(Registry.BIOME.get(new ResourceLocation(dynamic.get("biome").asString(""))));
        dynamic.get("structures").flatMap((Function)Dynamic::getMapValues).ifPresent(map -> map.keySet().forEach(dynamic -> dynamic.asString().map(string -> ciy2.getStructuresOptions().put(string, Maps.newHashMap()))));
        return ciy2;
    }
    
    public static FlatLevelGeneratorSettings fromString(final String string) {
        final Iterator<String> iterator2 = Splitter.on(';').split(string).iterator();
        if (!iterator2.hasNext()) {
            return getDefault();
        }
        final FlatLevelGeneratorSettings ciy3 = ChunkGeneratorType.FLAT.createSettings();
        final List<FlatLayerInfo> list4 = getLayersInfoFromString(iterator2.next());
        if (list4.isEmpty()) {
            return getDefault();
        }
        ciy3.getLayersInfo().addAll(list4);
        ciy3.updateLayers();
        Biome bkt5 = Biomes.PLAINS;
        if (iterator2.hasNext()) {
            try {
                final ResourceLocation sm6 = new ResourceLocation(iterator2.next());
                final Object o;
                final Object obj;
                bkt5 = Registry.BIOME.getOptional(sm6).<Throwable>orElseThrow(() -> {
                    new IllegalArgumentException("Invalid Biome: " + obj);
                    return o;
                });
            }
            catch (Exception exception6) {
                FlatLevelGeneratorSettings.LOGGER.error("Error while parsing flat world string => {}", exception6.getMessage());
            }
        }
        ciy3.setBiome(bkt5);
        if (iterator2.hasNext()) {
            final String[] split;
            final String[] arr6 = split = iterator2.next().toLowerCase(Locale.ROOT).split(",");
            for (final String string2 : split) {
                final String[] arr7 = string2.split("\\(", 2);
                if (!arr7[0].isEmpty()) {
                    ciy3.addStructure(arr7[0]);
                    if (arr7.length > 1 && arr7[1].endsWith(")") && arr7[1].length() > 1) {
                        final String[] split2;
                        final String[] arr8 = split2 = arr7[1].substring(0, arr7[1].length() - 1).split(" ");
                        for (final String string3 : split2) {
                            final String[] arr9 = string3.split("=", 2);
                            if (arr9.length == 2) {
                                ciy3.addStructureOption(arr7[0], arr9[0], arr9[1]);
                            }
                        }
                    }
                }
            }
        }
        else {
            ciy3.getStructuresOptions().put("village", Maps.newHashMap());
        }
        return ciy3;
    }
    
    private void addStructure(final String string) {
        final Map<String, String> map3 = Maps.newHashMap();
        this.structuresOptions.put(string, map3);
    }
    
    private void addStructureOption(final String string1, final String string2, final String string3) {
        this.structuresOptions.get(string1).put(string2, string3);
        if ("village".equals(string1) && "distance".equals(string2)) {
            this.villagesSpacing = Mth.getInt(string3, this.villagesSpacing, 9);
        }
        if ("biome_1".equals(string1) && "distance".equals(string2)) {
            this.templesSpacing = Mth.getInt(string3, this.templesSpacing, 9);
        }
        if ("stronghold".equals(string1)) {
            if ("distance".equals(string2)) {
                this.strongholdsDistance = Mth.getInt(string3, this.strongholdsDistance, 1);
            }
            else if ("count".equals(string2)) {
                this.strongholdsCount = Mth.getInt(string3, this.strongholdsCount, 1);
            }
            else if ("spread".equals(string2)) {
                this.strongholdsSpread = Mth.getInt(string3, this.strongholdsSpread, 1);
            }
        }
        if ("oceanmonument".equals(string1)) {
            if ("separation".equals(string2)) {
                this.monumentsSeparation = Mth.getInt(string3, this.monumentsSeparation, 1);
            }
            else if ("spacing".equals(string2)) {
                this.monumentsSpacing = Mth.getInt(string3, this.monumentsSpacing, 1);
            }
        }
        if ("endcity".equals(string1) && "distance".equals(string2)) {
            this.endCitySpacing = Mth.getInt(string3, this.endCitySpacing, 1);
        }
        if ("mansion".equals(string1) && "distance".equals(string2)) {
            this.woodlandMansionSpacing = Mth.getInt(string3, this.woodlandMansionSpacing, 1);
        }
    }
    
    public static FlatLevelGeneratorSettings getDefault() {
        final FlatLevelGeneratorSettings ciy1 = ChunkGeneratorType.FLAT.createSettings();
        ciy1.setBiome(Biomes.PLAINS);
        ciy1.getLayersInfo().add(new FlatLayerInfo(1, Blocks.BEDROCK));
        ciy1.getLayersInfo().add(new FlatLayerInfo(2, Blocks.DIRT));
        ciy1.getLayersInfo().add(new FlatLayerInfo(1, Blocks.GRASS_BLOCK));
        ciy1.updateLayers();
        ciy1.getStructuresOptions().put("village", Maps.newHashMap());
        return ciy1;
    }
    
    public boolean isVoidGen() {
        return this.voidGen;
    }
    
    public BlockState[] getLayers() {
        return this.layers;
    }
    
    public void deleteLayer(final int integer) {
        this.layers[integer] = null;
    }
    
    static {
        LOGGER = LogManager.getLogger();
        MINESHAFT_COMPOSITE_FEATURE = Feature.MINESHAFT.configured(new MineshaftConfiguration(0.004, MineshaftFeature.Type.NORMAL)).decorated(FeatureDecorator.NOPE.configured(DecoratorConfiguration.NONE));
        VILLAGE_COMPOSITE_FEATURE = Feature.VILLAGE.configured(new VillageConfiguration("village/plains/town_centers", 6)).decorated(FeatureDecorator.NOPE.configured(DecoratorConfiguration.NONE));
        STRONGHOLD_COMPOSITE_FEATURE = Feature.STRONGHOLD.configured(FeatureConfiguration.NONE).decorated(FeatureDecorator.NOPE.configured(DecoratorConfiguration.NONE));
        SWAMPHUT_COMPOSITE_FEATURE = Feature.SWAMP_HUT.configured(FeatureConfiguration.NONE).decorated(FeatureDecorator.NOPE.configured(DecoratorConfiguration.NONE));
        DESERT_PYRAMID_COMPOSITE_FEATURE = Feature.DESERT_PYRAMID.configured(FeatureConfiguration.NONE).decorated(FeatureDecorator.NOPE.configured(DecoratorConfiguration.NONE));
        JUNGLE_PYRAMID_COMPOSITE_FEATURE = Feature.JUNGLE_TEMPLE.configured(FeatureConfiguration.NONE).decorated(FeatureDecorator.NOPE.configured(DecoratorConfiguration.NONE));
        IGLOO_COMPOSITE_FEATURE = Feature.IGLOO.configured(FeatureConfiguration.NONE).decorated(FeatureDecorator.NOPE.configured(DecoratorConfiguration.NONE));
        SHIPWRECK_COMPOSITE_FEATURE = Feature.SHIPWRECK.configured(new ShipwreckConfiguration(false)).decorated(FeatureDecorator.NOPE.configured(DecoratorConfiguration.NONE));
        OCEAN_MONUMENT_COMPOSITE_FEATURE = Feature.OCEAN_MONUMENT.configured(FeatureConfiguration.NONE).decorated(FeatureDecorator.NOPE.configured(DecoratorConfiguration.NONE));
        WATER_LAKE_COMPOSITE_FEATURE = Feature.LAKE.configured(new BlockStateConfiguration(Blocks.WATER.defaultBlockState())).decorated(FeatureDecorator.WATER_LAKE.configured(new ChanceDecoratorConfiguration(4)));
        LAVA_LAKE_COMPOSITE_FEATURE = Feature.LAKE.configured(new BlockStateConfiguration(Blocks.LAVA.defaultBlockState())).decorated(FeatureDecorator.LAVA_LAKE.configured(new ChanceDecoratorConfiguration(80)));
        ENDCITY_COMPOSITE_FEATURE = Feature.END_CITY.configured(FeatureConfiguration.NONE).decorated(FeatureDecorator.NOPE.configured(DecoratorConfiguration.NONE));
        WOOLAND_MANSION_COMPOSITE_FEATURE = Feature.WOODLAND_MANSION.configured(FeatureConfiguration.NONE).decorated(FeatureDecorator.NOPE.configured(DecoratorConfiguration.NONE));
        FORTRESS_COMPOSITE_FEATURE = Feature.NETHER_BRIDGE.configured(FeatureConfiguration.NONE).decorated(FeatureDecorator.NOPE.configured(DecoratorConfiguration.NONE));
        OCEAN_RUIN_COMPOSITE_FEATURE = Feature.OCEAN_RUIN.configured(new OceanRuinConfiguration(OceanRuinFeature.Type.COLD, 0.3f, 0.1f)).decorated(FeatureDecorator.NOPE.configured(DecoratorConfiguration.NONE));
        PILLAGER_OUTPOST_COMPOSITE_FEATURE = Feature.PILLAGER_OUTPOST.configured(FeatureConfiguration.NONE).decorated(FeatureDecorator.NOPE.configured(DecoratorConfiguration.NONE));
        STRUCTURE_FEATURES_STEP = Util.<Map<ConfiguredFeature<?, ?>, GenerationStep.Decoration>>make(Maps.newHashMap(), hashMap -> {
            hashMap.put(FlatLevelGeneratorSettings.MINESHAFT_COMPOSITE_FEATURE, GenerationStep.Decoration.UNDERGROUND_STRUCTURES);
            hashMap.put(FlatLevelGeneratorSettings.VILLAGE_COMPOSITE_FEATURE, GenerationStep.Decoration.SURFACE_STRUCTURES);
            hashMap.put(FlatLevelGeneratorSettings.STRONGHOLD_COMPOSITE_FEATURE, GenerationStep.Decoration.UNDERGROUND_STRUCTURES);
            hashMap.put(FlatLevelGeneratorSettings.SWAMPHUT_COMPOSITE_FEATURE, GenerationStep.Decoration.SURFACE_STRUCTURES);
            hashMap.put(FlatLevelGeneratorSettings.DESERT_PYRAMID_COMPOSITE_FEATURE, GenerationStep.Decoration.SURFACE_STRUCTURES);
            hashMap.put(FlatLevelGeneratorSettings.JUNGLE_PYRAMID_COMPOSITE_FEATURE, GenerationStep.Decoration.SURFACE_STRUCTURES);
            hashMap.put(FlatLevelGeneratorSettings.IGLOO_COMPOSITE_FEATURE, GenerationStep.Decoration.SURFACE_STRUCTURES);
            hashMap.put(FlatLevelGeneratorSettings.SHIPWRECK_COMPOSITE_FEATURE, GenerationStep.Decoration.SURFACE_STRUCTURES);
            hashMap.put(FlatLevelGeneratorSettings.OCEAN_RUIN_COMPOSITE_FEATURE, GenerationStep.Decoration.SURFACE_STRUCTURES);
            hashMap.put(FlatLevelGeneratorSettings.WATER_LAKE_COMPOSITE_FEATURE, GenerationStep.Decoration.LOCAL_MODIFICATIONS);
            hashMap.put(FlatLevelGeneratorSettings.LAVA_LAKE_COMPOSITE_FEATURE, GenerationStep.Decoration.LOCAL_MODIFICATIONS);
            hashMap.put(FlatLevelGeneratorSettings.ENDCITY_COMPOSITE_FEATURE, GenerationStep.Decoration.SURFACE_STRUCTURES);
            hashMap.put(FlatLevelGeneratorSettings.WOOLAND_MANSION_COMPOSITE_FEATURE, GenerationStep.Decoration.SURFACE_STRUCTURES);
            hashMap.put(FlatLevelGeneratorSettings.FORTRESS_COMPOSITE_FEATURE, GenerationStep.Decoration.UNDERGROUND_STRUCTURES);
            hashMap.put(FlatLevelGeneratorSettings.OCEAN_MONUMENT_COMPOSITE_FEATURE, GenerationStep.Decoration.SURFACE_STRUCTURES);
            hashMap.put(FlatLevelGeneratorSettings.PILLAGER_OUTPOST_COMPOSITE_FEATURE, GenerationStep.Decoration.SURFACE_STRUCTURES);
            return;
        });
        STRUCTURE_FEATURES = Util.<Map<String, ConfiguredFeature<?, ?>[]>>make(Maps.newHashMap(), hashMap -> {
            hashMap.put("mineshaft", new ConfiguredFeature[] { FlatLevelGeneratorSettings.MINESHAFT_COMPOSITE_FEATURE });
            hashMap.put("village", new ConfiguredFeature[] { FlatLevelGeneratorSettings.VILLAGE_COMPOSITE_FEATURE });
            hashMap.put("stronghold", new ConfiguredFeature[] { FlatLevelGeneratorSettings.STRONGHOLD_COMPOSITE_FEATURE });
            hashMap.put("biome_1", new ConfiguredFeature[] { FlatLevelGeneratorSettings.SWAMPHUT_COMPOSITE_FEATURE, FlatLevelGeneratorSettings.DESERT_PYRAMID_COMPOSITE_FEATURE, FlatLevelGeneratorSettings.JUNGLE_PYRAMID_COMPOSITE_FEATURE, FlatLevelGeneratorSettings.IGLOO_COMPOSITE_FEATURE, FlatLevelGeneratorSettings.OCEAN_RUIN_COMPOSITE_FEATURE, FlatLevelGeneratorSettings.SHIPWRECK_COMPOSITE_FEATURE });
            hashMap.put("oceanmonument", new ConfiguredFeature[] { FlatLevelGeneratorSettings.OCEAN_MONUMENT_COMPOSITE_FEATURE });
            hashMap.put("lake", new ConfiguredFeature[] { FlatLevelGeneratorSettings.WATER_LAKE_COMPOSITE_FEATURE });
            hashMap.put("lava_lake", new ConfiguredFeature[] { FlatLevelGeneratorSettings.LAVA_LAKE_COMPOSITE_FEATURE });
            hashMap.put("endcity", new ConfiguredFeature[] { FlatLevelGeneratorSettings.ENDCITY_COMPOSITE_FEATURE });
            hashMap.put("mansion", new ConfiguredFeature[] { FlatLevelGeneratorSettings.WOOLAND_MANSION_COMPOSITE_FEATURE });
            hashMap.put("fortress", new ConfiguredFeature[] { FlatLevelGeneratorSettings.FORTRESS_COMPOSITE_FEATURE });
            hashMap.put("pillager_outpost", new ConfiguredFeature[] { FlatLevelGeneratorSettings.PILLAGER_OUTPOST_COMPOSITE_FEATURE });
            return;
        });
        STRUCTURE_FEATURES_DEFAULT = Util.<Map<ConfiguredFeature<?, ?>, FeatureConfiguration>>make(Maps.newHashMap(), hashMap -> {
            hashMap.put(FlatLevelGeneratorSettings.MINESHAFT_COMPOSITE_FEATURE, new MineshaftConfiguration(0.004, MineshaftFeature.Type.NORMAL));
            hashMap.put(FlatLevelGeneratorSettings.VILLAGE_COMPOSITE_FEATURE, (MineshaftConfiguration)new VillageConfiguration("village/plains/town_centers", 6));
            hashMap.put(FlatLevelGeneratorSettings.STRONGHOLD_COMPOSITE_FEATURE, (MineshaftConfiguration)FeatureConfiguration.NONE);
            hashMap.put(FlatLevelGeneratorSettings.SWAMPHUT_COMPOSITE_FEATURE, (MineshaftConfiguration)FeatureConfiguration.NONE);
            hashMap.put(FlatLevelGeneratorSettings.DESERT_PYRAMID_COMPOSITE_FEATURE, (MineshaftConfiguration)FeatureConfiguration.NONE);
            hashMap.put(FlatLevelGeneratorSettings.JUNGLE_PYRAMID_COMPOSITE_FEATURE, (MineshaftConfiguration)FeatureConfiguration.NONE);
            hashMap.put(FlatLevelGeneratorSettings.IGLOO_COMPOSITE_FEATURE, (MineshaftConfiguration)FeatureConfiguration.NONE);
            hashMap.put(FlatLevelGeneratorSettings.OCEAN_RUIN_COMPOSITE_FEATURE, (MineshaftConfiguration)new OceanRuinConfiguration(OceanRuinFeature.Type.COLD, 0.3f, 0.9f));
            hashMap.put(FlatLevelGeneratorSettings.SHIPWRECK_COMPOSITE_FEATURE, (MineshaftConfiguration)new ShipwreckConfiguration(false));
            hashMap.put(FlatLevelGeneratorSettings.OCEAN_MONUMENT_COMPOSITE_FEATURE, (MineshaftConfiguration)FeatureConfiguration.NONE);
            hashMap.put(FlatLevelGeneratorSettings.ENDCITY_COMPOSITE_FEATURE, (MineshaftConfiguration)FeatureConfiguration.NONE);
            hashMap.put(FlatLevelGeneratorSettings.WOOLAND_MANSION_COMPOSITE_FEATURE, (MineshaftConfiguration)FeatureConfiguration.NONE);
            hashMap.put(FlatLevelGeneratorSettings.FORTRESS_COMPOSITE_FEATURE, (MineshaftConfiguration)FeatureConfiguration.NONE);
            hashMap.put(FlatLevelGeneratorSettings.PILLAGER_OUTPOST_COMPOSITE_FEATURE, (MineshaftConfiguration)FeatureConfiguration.NONE);
        });
    }
}
