package mod.acgaming.spackenmobs.misc; import net.minecraft.entity.Entity; import net.minecraft.entity.EnumCreatureType; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome.SpawnListEntry; import java.util.ArrayList; import java.util.List; // Thanks to Vazkii! public class BiomeHelper { public static Biome[] getBiomesWithMonster(Class clazz) { List biomes = new ArrayList<>(); for (Biome b : Biome.REGISTRY) { List spawnList = b.getSpawnableList(EnumCreatureType.MONSTER); for (SpawnListEntry e : spawnList) if (e.entityClass == clazz) { biomes.add(b); break; } } return biomes.toArray(new Biome[0]); } public static Biome[] getBiomesWithCreature(Class clazz) { List biomes = new ArrayList<>(); for (Biome b : Biome.REGISTRY) { List spawnList = b.getSpawnableList(EnumCreatureType.CREATURE); for (SpawnListEntry e : spawnList) if (e.entityClass == clazz) { biomes.add(b); break; } } return biomes.toArray(new Biome[0]); } }