diff --git a/common/MysticRuins/Config.java b/common/MysticRuins/Config.java index 2151f5d..78331ee 100644 --- a/common/MysticRuins/Config.java +++ b/common/MysticRuins/Config.java @@ -1,16 +1,19 @@ package mysticruins; import java.io.File; -import java.util.ArrayList; -import java.util.List; +import java.util.HashSet; +import java.util.Set; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraftforge.common.BiomeDictionary; +import net.minecraftforge.common.BiomeDictionary.Type; import net.minecraftforge.common.Configuration; public class Config { public static Configuration config; public static int RuinRarity; public static int DunRarity; - public static List[] allowId = new ArrayList[4]; + public static Set[] allowId = new HashSet[4]; public static final String[] allows = { "Ruin allowed dimension id", "Dungeon allowed dimension id", "Ruin allowed biome id", "Dungeon allowed biome id" }; public static void initialize(File file) { @@ -20,12 +23,32 @@ public class Config { DunRarity = config.get("General", "Mystic Dungeon Rarity", 1, "Tries per chunk : lower to make rarer").getInt(); String[] ID; for (int i = 0; i < allows.length; i++) { - ID = config.get("General", allows[i], i < 2 ? "0," : "1,2,3,4,5,6,7,21,22").getString().split(","); - allowId[i] = new ArrayList(); + ID = config.get("General", allows[i], i < 2 ? "0," : "1,2,3,4,5,6,7,21,22", i < 2 ? "" : "Use ALL or * for all biomes, biome id or biome tags").getString().split(","); + allowId[i] = new HashSet(); for (String txt : ID) { try { allowId[i].add(Integer.parseInt(txt.trim())); } catch (NumberFormatException e) { + if (i > 1) { + if (txt.equals("*") || txt.equalsIgnoreCase("ALL")) { + allowId[i].clear(); + for (BiomeGenBase biome : BiomeGenBase.biomeList) { + if (biome != null) { + allowId[i].add(biome.biomeID); + } + } + break; + } else { + try { + for (BiomeGenBase biome : BiomeDictionary.getBiomesForType(Type.valueOf(txt.toUpperCase()))) { + if (biome != null) { + allowId[i].add(biome.biomeID); + } + } + } catch (IllegalArgumentException l) { + } + } + } } } }