Skip to content

Commit

Permalink
Add a dimension whitelist setting for draconic ore (#48)
Browse files Browse the repository at this point in the history
* Add a dimension whitelist setting for draconic ore

* Fix typo
  • Loading branch information
eigenraven authored Apr 28, 2024
1 parent 6c48064 commit 8858c59
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class ConfigHandler {
public static boolean sumonRitualAccelerated;
public static int[] dragonEggSpawnLocation;
public static int[] oreGenDimentionBlacklist;
public static int[] oreGenDimensionWhitelist;
public static int[] hudSettings;
private static String[] disabledBlocksItems;
public static List<String> disabledNamesList = new ArrayList<String>();
Expand Down Expand Up @@ -193,6 +194,12 @@ public static void syncConfig() {
"Ore gen dimension blacklist",
new int[0],
"Add the id's of dimensions you do not want draconium ore to spawn in").getIntList();
oreGenDimensionWhitelist = config.get(
Configuration.CATEGORY_GENERAL,
"Ore gen dimension whitelist",
new int[0],
"Add the id's of dimensions you do want draconium ore to spawn in (if empty, uses only the blacklist)")
.getIntList();
disabledBlocksItems = config.getStringList(
"Disabled Blocks & Items",
Configuration.CATEGORY_GENERAL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,22 @@ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkP
generateNether(random, chunkX * 16, chunkZ * 16, world);
break;
default:
for (Integer i : ConfigHandler.oreGenDimentionBlacklist) {
if (i == world.provider.dimensionId) return;
if (ConfigHandler.oreGenDimensionWhitelist.length > 0) {
boolean isWhitelisted = false;
for (Integer dim : ConfigHandler.oreGenDimensionWhitelist) {
if (dim == world.provider.dimensionId) {
isWhitelisted = true;
break;
}
}
if (!isWhitelisted) {
return;
}
}
for (Integer dim : ConfigHandler.oreGenDimentionBlacklist) {
if (dim == world.provider.dimensionId) {
return;
}
}
addOreSpawn(ModBlocks.draconiumOre, world, random, chunkX * 16, chunkZ * 16, 3, 4, 2, 2, 8);
break;
Expand Down

0 comments on commit 8858c59

Please sign in to comment.