mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-24 05:44:24 +00:00
Added whitelist for dimension generation too
This commit is contained in:
1 parent
2b9b105211
commit
31bcc661cd
5 files changed
+49
-6
No files matched your search
@@ -23,12 +23,17 @@ public class HiveConfig {
|
||||
private final Set<Biome> blacklistedBiomes = new HashSet<>();
|
||||
|
||||
private static final Set<Integer> blacklistedDims = new HashSet<>();
|
||||
|
||||
private static final Set<Integer> whitelistedDims = 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(int dimId : config.get("world.generate.beehives", "dimWhitelist", new int[0]).getIntList()) {
|
||||
whitelistedDims.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));
|
||||
@@ -62,11 +67,18 @@ public class HiveConfig {
|
||||
return BiomeDictionary.getTypes(biome).stream().anyMatch(blacklistedTypes::contains);
|
||||
}
|
||||
|
||||
public static boolean isDimBlacklisted(int dimId) {
|
||||
return blacklistedDims.contains(dimId);
|
||||
public static boolean isDimAllowed(int dimId) { //blacklist has priority
|
||||
if(blacklistedDims.isEmpty() || !blacklistedDims.contains(dimId)) {
|
||||
return whitelistedDims.contains(dimId);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void addBlacklistedDim(int dimId) {
|
||||
blacklistedDims.add(dimId);
|
||||
}
|
||||
|
||||
public static void addWhitelistedDim(int dimId) {
|
||||
whitelistedDims.add(dimId);
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public final class Hive {
|
||||
}
|
||||
|
||||
public boolean isValidLocation(World world, BlockPos pos) {
|
||||
if(HiveConfig.isDimBlacklisted(world.provider.getDimension())) {
|
||||
if(!HiveConfig.isDimAllowed(world.provider.getDimension())) {
|
||||
return false;
|
||||
}
|
||||
return hiveDescription.getHiveGen().isValidLocation(world, pos);
|
||||
|
||||
@@ -55,8 +55,9 @@ public class TreeDecorator {
|
||||
}
|
||||
|
||||
public static void decorateTrees(World world, Random rand, int worldX, int worldZ) {
|
||||
if(Config.blacklistedTreeDims.contains(world.provider.getDimension()))
|
||||
if(!Config.isValidTreeDim(world.provider.getDimension())) {
|
||||
return;
|
||||
}
|
||||
if (biomeCache.isEmpty()) {
|
||||
generateBiomeCache(world, rand);
|
||||
}
|
||||
|
||||
@@ -80,12 +80,14 @@ public class Config {
|
||||
public static boolean generateCopperOre = true;
|
||||
public static boolean generateTinOre = true;
|
||||
public static Set<Integer> blacklistedOreDims = new HashSet<Integer>();
|
||||
public static Set<Integer> whitelistedOreDims = new HashSet<Integer>();
|
||||
private static float generateBeehivesAmount = 1.0f;
|
||||
public static boolean generateBeehivesDebug = false;
|
||||
public static boolean logHivePlacement = false;
|
||||
public static boolean enableVillagers = true;
|
||||
public static boolean generateTrees = true;
|
||||
public static Set<Integer> blacklistedTreeDims = new HashSet<Integer>();
|
||||
public static Set<Integer> whitelistedTreeDims = new HashSet<Integer>();
|
||||
|
||||
// Retrogen
|
||||
public static boolean doRetrogen = false;
|
||||
@@ -163,9 +165,31 @@ public class Config {
|
||||
blacklistedTreeDims.add(dimID);
|
||||
}
|
||||
|
||||
public static void whitelistTreeDim(int dimID) {
|
||||
whitelistedTreeDims.add(dimID);
|
||||
}
|
||||
|
||||
public static void blacklistOreDim(int dimID) {
|
||||
blacklistedOreDims.add(dimID);
|
||||
}
|
||||
|
||||
public static void whitelistOreDim(int dimID) {
|
||||
whitelistedOreDims.add(dimID);
|
||||
}
|
||||
|
||||
public static boolean isValidOreDim(int dimID) { //blacklist has priority
|
||||
if(blacklistedOreDims.isEmpty() || !blacklistedOreDims.contains(dimID)) {
|
||||
return whitelistedOreDims.contains(dimID);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isValidTreeDim(int dimID) { //blacklist has priority
|
||||
if(blacklistedTreeDims.isEmpty() || !blacklistedTreeDims.contains(dimID)) {
|
||||
return whitelistedTreeDims.contains(dimID);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void load(Side side) {
|
||||
File configCommonFile = new File(Forestry.instance.getConfigFolder(), CATEGORY_COMMON + ".cfg");
|
||||
@@ -235,9 +259,12 @@ public class Config {
|
||||
generateApatiteOre = configCommon.getBooleanLocalized("world.generate.ore", "apatite", generateApatiteOre);
|
||||
generateCopperOre = configCommon.getBooleanLocalized("world.generate.ore", "copper", generateCopperOre);
|
||||
generateTinOre = configCommon.getBooleanLocalized("world.generate.ore", "tin", generateTinOre);
|
||||
for(int dimId : configCommon.get("world.generate.ore", "dimBlacklist", new int[0]).getIntList()){
|
||||
for(int dimId : configCommon.get("world.generate.ore", "dimBlacklist", new int[0]).getIntList()) {
|
||||
blacklistedOreDims.add(dimId);
|
||||
}
|
||||
for(int dimId : configCommon.get("world.generate.ore", "dimWhitelist", new int[0]).getIntList()) {
|
||||
whitelistedOreDims.add(dimId);
|
||||
}
|
||||
|
||||
enableVillagers = configCommon.getBooleanLocalized("world.generate", "villagers", enableVillagers);
|
||||
|
||||
@@ -245,6 +272,9 @@ public class Config {
|
||||
for(int dimId : configCommon.get("world.generate.trees", "dimBlacklist", new int[0]).getIntList()){
|
||||
blacklistedTreeDims.add(dimId);
|
||||
}
|
||||
for(int dimId : configCommon.get("world.generate.trees", "dimWhitelist", new int[0]).getIntList()){
|
||||
whitelistedTreeDims.add(dimId);
|
||||
}
|
||||
|
||||
|
||||
craftingBronzeEnabled = configCommon.getBooleanLocalized("crafting", "bronze", craftingBronzeEnabled);
|
||||
|
||||
@@ -68,7 +68,7 @@ public class WorldGenerator implements IWorldGenerator {
|
||||
}
|
||||
|
||||
private void generateWorld(Random random, int chunkX, int chunkZ, World world) {
|
||||
if(Config.blacklistedOreDims.contains(world.provider.getDimension()))
|
||||
if(!Config.isValidOreDim(world.provider.getDimension()))
|
||||
return;
|
||||
|
||||
if (apatiteGenerator == null || copperGenerator == null || tinGenerator == null) {
|
||||
|
||||
Reference in new issue
Block a user