Example usage for net.minecraftforge.common BiomeManager getBiomes

List of usage examples for net.minecraftforge.common BiomeManager getBiomes

Introduction

In this page you can find the example usage for net.minecraftforge.common BiomeManager getBiomes.

Prototype

@Nullable
    public static ImmutableList<BiomeEntry> getBiomes(BiomeType type) 

Source Link

Usage

From source file:com.kegare.caveworld.util.CaveUtils.java

License:Minecraft Mod Public

public static boolean biomeFilter(BiomeGenBase biome, String filter) {
    if (biome == null || Strings.isNullOrEmpty(filter)) {
        return false;
    }//  w  w w.ja v  a 2  s  .c  o m

    if (biome.biomeID == NumberUtils.toInt(filter, -1) || containsIgnoreCase(biome.biomeName, filter)) {
        return true;
    }

    try {
        if (BiomeDictionary.isBiomeOfType(biome, Type.valueOf(filter.toUpperCase()))) {
            return true;
        }
    } catch (Throwable e) {
    }

    try {
        if (blockFilter(new BlockEntry(biome.topBlock, biome.field_150604_aj), filter)) {
            return true;
        }
    } catch (Throwable e) {
    }

    try {
        if (blockFilter(new BlockEntry(biome.fillerBlock, biome.field_76754_C), filter)) {
            return true;
        }
    } catch (Throwable e) {
    }

    try {
        BiomeType type = BiomeType.valueOf(filter.toUpperCase());

        if (type != null) {
            for (BiomeEntry entry : BiomeManager.getBiomes(type)) {
                if (entry.biome.biomeID == biome.biomeID) {
                    return true;
                }
            }
        }
    } catch (Throwable e) {
    }

    return false;
}