mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Change structure/dungeon configs to be trinary (true|false|flag)
This commit is contained in:
parent
30969b281f
commit
0146e82866
@ -87,4 +87,21 @@ public class CommonConfig {
|
||||
return prop.getStringList();
|
||||
}
|
||||
|
||||
public static int parseStructureFlag(String flag) {
|
||||
if(flag == null) flag = "";
|
||||
|
||||
switch(flag.toLowerCase(Locale.US)) {
|
||||
case "true":
|
||||
case "on":
|
||||
case "yes":
|
||||
return 1;
|
||||
case "false":
|
||||
case "off":
|
||||
case "no":
|
||||
return 0;
|
||||
default:
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ public class GeneralConfig {
|
||||
public static boolean enableDebugMode = true;
|
||||
public static boolean enableMycelium = false;
|
||||
public static boolean enablePlutoniumOre = false;
|
||||
public static boolean enableDungeons = true;
|
||||
public static int enableDungeons = 2;
|
||||
public static boolean enableMDOres = true;
|
||||
public static boolean enableMines = true;
|
||||
public static boolean enableRad = true;
|
||||
@ -73,7 +73,10 @@ public class GeneralConfig {
|
||||
enableDebugMode = config.get(CATEGORY_GENERAL, "1.00_enableDebugMode", false, "Enable debugging mode").getBoolean(false);
|
||||
enableMycelium = config.get(CATEGORY_GENERAL, "1.01_enableMyceliumSpread", false, "Allows glowing mycelium to spread").getBoolean(false);
|
||||
enablePlutoniumOre = config.get(CATEGORY_GENERAL, "1.02_enablePlutoniumNetherOre", false, "Enables plutonium ore generation in the nether").getBoolean(false);
|
||||
enableDungeons = config.get(CATEGORY_GENERAL, "1.03_enableDungeonSpawn", true, "Allows structures and dungeons to spawn").getBoolean(true);
|
||||
|
||||
String unparsedDungeonFlag = config.get(CATEGORY_GENERAL, "1.03_enableDungeonSpawn", "flag", "Allows structures and dungeons to spawn. Valid values are true|false|flag - flag will respect the \"Generate Structures\" world flag.").getString();
|
||||
enableDungeons = CommonConfig.parseStructureFlag(unparsedDungeonFlag);
|
||||
|
||||
enableMDOres = config.get(CATEGORY_GENERAL, "1.04_enableOresInModdedDimensions", true, "Allows NTM ores to generate in modded dimensions").getBoolean(true);
|
||||
enableMines = config.get(CATEGORY_GENERAL, "1.05_enableLandmineSpawn", true, "Allows landmines to generate").getBoolean(true);
|
||||
enableRad = config.get(CATEGORY_GENERAL, "1.06_enableRadHotspotSpawn", true, "Allows radiation hotspots to generate").getBoolean(true);
|
||||
|
||||
@ -8,7 +8,7 @@ import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
public class StructureConfig {
|
||||
|
||||
public static boolean enableStructures = true;
|
||||
public static int enableStructures = 2;
|
||||
|
||||
public static int structureMinChunks = 8;
|
||||
public static int structureMaxChunks = 24;
|
||||
@ -18,7 +18,10 @@ public class StructureConfig {
|
||||
public static void loadFromConfig(Configuration config) {
|
||||
|
||||
final String CATEGORY_STRUCTURES = CommonConfig.CATEGORY_STRUCTURES;
|
||||
enableStructures = CommonConfig.createConfigBool(config, CATEGORY_STRUCTURES, "5.00_enableStructures", "Switch for whether structures using the MapGenStructure system spawn.", true);
|
||||
|
||||
String unparsedStructureFlag = CommonConfig.createConfigString(config, CATEGORY_STRUCTURES, "5.00_enableStructures", "Flag for whether modern NTM structures will spawn. Valid values are true|false|flag - flag will respect the \"Generate Structures\" world flag.", "flag");
|
||||
|
||||
enableStructures = CommonConfig.parseStructureFlag(unparsedStructureFlag);
|
||||
|
||||
structureMinChunks = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.01_structureMinChunks", "Minimum non-zero distance between structures in chunks (Settings lower than 8 may be problematic).", 8);
|
||||
structureMaxChunks = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.02_structureMaxChunks", "Maximum non-zero distance between structures in chunks.", 24);
|
||||
|
||||
@ -220,8 +220,10 @@ public class HbmWorldGen implements IWorldGenerator {
|
||||
}
|
||||
|
||||
boolean enableDungeons = world.getWorldInfo().isMapFeaturesEnabled();
|
||||
if(GeneralConfig.enableDungeons == 1) enableDungeons = true;
|
||||
if(GeneralConfig.enableDungeons == 0) enableDungeons = false;
|
||||
|
||||
if(GeneralConfig.enableDungeons && world.provider.dimensionId == 0 && enableDungeons) {
|
||||
if(enableDungeons && world.provider.dimensionId == 0) {
|
||||
|
||||
if(MobConfig.enableHives && rand.nextInt(MobConfig.hiveSpawn) == 0) {
|
||||
int x = i + rand.nextInt(16) + 8;
|
||||
|
||||
@ -49,7 +49,8 @@ public class NTMWorldGenerator implements IWorldGenerator {
|
||||
setRandomSeed(event.world, event.chunkX, event.chunkZ); //Set random for population down the line.
|
||||
hasPopulationEvent = true;
|
||||
|
||||
if(!StructureConfig.enableStructures || !event.world.getWorldInfo().isMapFeaturesEnabled()) return;
|
||||
if(StructureConfig.enableStructures == 0) return;
|
||||
if(StructureConfig.enableStructures == 2 && !event.world.getWorldInfo().isMapFeaturesEnabled()) return;
|
||||
|
||||
switch (event.world.provider.dimensionId) {
|
||||
case -1:
|
||||
@ -94,7 +95,12 @@ public class NTMWorldGenerator implements IWorldGenerator {
|
||||
private void generateSurface(World world, Random rand, IChunkProvider chunkGenerator, IChunkProvider chunkProvider, int chunkX, int chunkZ) {
|
||||
if(!hasPopulationEvent) { //If we've failed to generate any structures (flatlands)
|
||||
setRandomSeed(world, chunkX, chunkZ); //Reset the random seed to compensate
|
||||
if(StructureConfig.enableStructures) generateOverworldStructures(world, chunkGenerator, chunkX, chunkZ); //Do it through the post-population generation directly
|
||||
|
||||
boolean enableStructures = world.getWorldInfo().isMapFeaturesEnabled();
|
||||
if(StructureConfig.enableStructures == 1) enableStructures = true;
|
||||
if(StructureConfig.enableStructures == 0) enableStructures = false;
|
||||
|
||||
if(enableStructures) generateOverworldStructures(world, chunkGenerator, chunkX, chunkZ); //Do it through the post-population generation directly
|
||||
}
|
||||
|
||||
/* biome dictionary my beloved <3
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user