// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.server.worldgen.loader.biome;

import javax.annotation.Nullable;
import com.hypixel.hytale.server.worldgen.biome.CustomBiomeGenerator;
import com.hypixel.hytale.server.worldgen.biome.CustomBiome;
import com.hypixel.hytale.server.worldgen.loader.context.BiomeFileContext;
import com.google.gson.JsonElement;
import java.nio.file.Path;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.worldgen.SeedStringResource;
import com.hypixel.hytale.procedurallib.json.SeedString;
import com.hypixel.hytale.server.worldgen.biome.Biome;

public class CustomBiomeJsonLoader extends BiomeJsonLoader
{
    protected final Biome[] tileBiomes;
    
    public CustomBiomeJsonLoader(@Nonnull final SeedString<SeedStringResource> seed, final Path dataFolder, final JsonElement json, @Nonnull final BiomeFileContext biomeContext, final Biome[] tileBiomes) {
        super(seed.append(String.format("TileBiome-%s", biomeContext.getName())), dataFolder, json, biomeContext);
        this.tileBiomes = tileBiomes;
    }
    
    @Nonnull
    @Override
    public CustomBiome load() {
        return new CustomBiome(this.biomeContext.getId(), this.biomeContext.getName(), this.loadInterpolation(), this.loadCustomBiomeGenerator(), this.loadTerrainHeightThreshold(), this.loadCoverContainer(), this.loadLayerContainers(), this.loadPrefabContainer(), this.loadTintContainer(), this.loadEnvironmentContainer(), this.loadWaterContainer(), this.loadFadeContainer(), this.loadHeightmapNoise(), this.loadColor());
    }
    
    @Nullable
    protected CustomBiomeGenerator loadCustomBiomeGenerator() {
        CustomBiomeGenerator customBiomeGenerator = null;
        if (this.has("CustomBiomeGenerator")) {
            customBiomeGenerator = new CustomBiomeGeneratorJsonLoader((SeedString<SeedStringResource>)this.seed, this.dataFolder, this.get("CustomBiomeGenerator"), this.biomeContext, this.tileBiomes).load();
        }
        return customBiomeGenerator;
    }
    
    public interface Constants
    {
        public static final String KEY_CUSTOM_BIOME_GENERATOR = "CustomBiomeGenerator";
        public static final String SEED_PREFIX = "TileBiome-%s";
    }
}
