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

package com.hypixel.hytale.server.worldgen.loader.cave.shape;

import javax.annotation.Nullable;
import com.hypixel.hytale.procedurallib.json.NoisePropertyJsonLoader;
import com.hypixel.hytale.procedurallib.property.NoiseProperty;
import com.google.gson.JsonElement;
import java.nio.file.Path;
import javax.annotation.Nonnull;
import com.hypixel.hytale.procedurallib.json.SeedString;
import com.hypixel.hytale.server.worldgen.cave.shape.distorted.ShapeDistortion;
import com.hypixel.hytale.procedurallib.json.JsonLoader;
import com.hypixel.hytale.procedurallib.json.SeedResource;

public class ShapeDistortionJsonLoader<K extends SeedResource> extends JsonLoader<K, ShapeDistortion>
{
    public ShapeDistortionJsonLoader(@Nonnull final SeedString<K> seed, final Path dataFolder, final JsonElement json) {
        super(seed.append(".ShapeDistortion"), dataFolder, json);
    }
    
    @Override
    public ShapeDistortion load() {
        return ShapeDistortion.of(this.loadWidth(), this.loadFloor(), this.loadCeiling());
    }
    
    @Nullable
    private NoiseProperty loadWidth() {
        if (this.has("Width")) {
            return new NoisePropertyJsonLoader(this.seed, this.dataFolder, this.get("Width")).load();
        }
        return null;
    }
    
    @Nullable
    private NoiseProperty loadFloor() {
        if (this.has("Floor")) {
            return new NoisePropertyJsonLoader(this.seed, this.dataFolder, this.get("Floor")).load();
        }
        return null;
    }
    
    @Nullable
    private NoiseProperty loadCeiling() {
        if (this.has("Ceiling")) {
            return new NoisePropertyJsonLoader(this.seed, this.dataFolder, this.get("Ceiling")).load();
        }
        return null;
    }
    
    public interface Constants
    {
        public static final String KEY_WIDTH = "Width";
        public static final String KEY_FLOOR = "Floor";
        public static final String KEY_CEILING = "Ceiling";
    }
}
