package net.minecraft.world.level.biome;

import net.minecraft.core.Registry;
import net.minecraft.world.level.storage.LevelData;
import java.util.function.Function;

public class BiomeSourceType<C extends BiomeSourceSettings, T extends BiomeSource> {
    public static final BiomeSourceType<CheckerboardBiomeSourceSettings, CheckerboardColumnBiomeSource> CHECKERBOARD;
    public static final BiomeSourceType<FixedBiomeSourceSettings, FixedBiomeSource> FIXED;
    public static final BiomeSourceType<OverworldBiomeSourceSettings, OverworldBiomeSource> VANILLA_LAYERED;
    public static final BiomeSourceType<TheEndBiomeSourceSettings, TheEndBiomeSource> THE_END;
    private final Function<C, T> factory;
    private final Function<LevelData, C> settingsFactory;
    
    private static <C extends BiomeSourceSettings, T extends BiomeSource> BiomeSourceType<C, T> register(final String string, final Function<C, T> function2, final Function<LevelData, C> function3) {
        return Registry.<BiomeSourceType<C, T>>register(Registry.BIOME_SOURCE_TYPE, string, new BiomeSourceType<C, T>(function2, function3));
    }
    
    private BiomeSourceType(final Function<C, T> function1, final Function<LevelData, C> function2) {
        this.factory = function1;
        this.settingsFactory = function2;
    }
    
    public T create(final C bkx) {
        return this.factory.apply(bkx);
    }
    
    public C createSettings(final LevelData crm) {
        return this.settingsFactory.apply(crm);
    }
    
    static {
        CHECKERBOARD = BiomeSourceType.<CheckerboardBiomeSourceSettings, CheckerboardColumnBiomeSource>register("checkerboard", CheckerboardColumnBiomeSource::new, CheckerboardBiomeSourceSettings::new);
        FIXED = BiomeSourceType.<FixedBiomeSourceSettings, FixedBiomeSource>register("fixed", FixedBiomeSource::new, FixedBiomeSourceSettings::new);
        VANILLA_LAYERED = BiomeSourceType.<OverworldBiomeSourceSettings, OverworldBiomeSource>register("vanilla_layered", OverworldBiomeSource::new, OverworldBiomeSourceSettings::new);
        THE_END = BiomeSourceType.<TheEndBiomeSourceSettings, TheEndBiomeSource>register("the_end", TheEndBiomeSource::new, TheEndBiomeSourceSettings::new);
    }
}
