Adds dimension blacklist for hive generation.

This commit is contained in:
phillipasmith1995 committed 2018-01-08 00:52:34 -06:00
1 parent 42865951a9
commit b40a6d4ec9
2 files changed
+11

No files matched your search

@@ -22,8 +22,13 @@ public class HiveConfig {
private final Set<BiomeDictionary.Type> blacklistedTypes = new HashSet<>();
private final Set<Biome> blacklistedBiomes = new HashSet<>();
private static final Set<Integer> blacklistedDims = new HashSet<>();
public static void parse(LocalizedConfiguration config){
config.addCategoryCommentLocalized(CATEGORY);
for(int dimId : config.get("world.generate.beehives", "dimBlacklist", new int[0]).getIntList()){
blacklistedDims.add(dimId);
}
for(IHiveRegistry.HiveType type : IHiveRegistry.HiveType.values()){
String[] entries = config.get(CATEGORY, type.getName(), new String[0]).getStringList();
configs.put(type, new HiveConfig(entries));
@@ -56,4 +61,7 @@ public class HiveConfig {
}
return BiomeDictionary.getTypes(biome).stream().anyMatch(blacklistedTypes::contains);
}
private static boolean isDimBlacklisted(int dimId) {
return blacklistedDims.contains(dimId);
}
@@ -66,6 +66,9 @@ public final class Hive {
}
public boolean isValidLocation(World world, BlockPos pos) {
if(HiveConfig.isDimBlacklisted(world.provider.getDimension())) {
return false;
}
return hiveDescription.getHiveGen().isValidLocation(world, pos);
}