Amongst other config file tweaks, made all per chunk values added by BOP configurable as booleans

This commit is contained in:
Adubbz 2014-01-16 09:37:29 +11:00
parent 7b7c21f161
commit 0f73559404
8 changed files with 66 additions and 36 deletions

View file

@ -2,6 +2,7 @@ package biomesoplenty;
import net.minecraft.creativetab.CreativeTabs;
import biomesoplenty.common.configuration.BOPConfiguration;
import biomesoplenty.common.configuration.BOPConfigurationWorldFeatures;
import biomesoplenty.common.core.BOPArmor;
import biomesoplenty.common.core.BOPBiomes;
import biomesoplenty.common.core.BOPBlocks;
@ -39,7 +40,7 @@ public class BiomesOPlenty
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
{
configPath = event.getModConfigurationDirectory() + "/biomesoplenty/";
BOPConfiguration.init(configPath);
@ -54,6 +55,7 @@ public class BiomesOPlenty
BOPCrafting.init();
BOPBiomes.init();
WorldGenFieldAssociation.init();
BOPConfigurationWorldFeatures.init(BOPConfiguration.worldFeaturesConfigFile);
ForcedBOPWorldGenerators.init();
ForcedDecorators.init();
BOPEntities.init();

View file

@ -5,6 +5,7 @@ import java.io.File;
public class BOPConfiguration
{
public static File mainConfigFile;
public static File worldFeaturesConfigFile;
public static File biomeGenConfigFile;
public static File terrainGenConfigFile;
public static File idConfigFile;
@ -13,6 +14,7 @@ public class BOPConfiguration
public static void init(String configpath)
{
mainConfigFile = new File(configpath + "main.cfg");
worldFeaturesConfigFile = new File(configpath + "worldfeatures.cfg");
biomeGenConfigFile = new File(configpath + "biomegen.cfg");
terrainGenConfigFile = new File(configpath + "terraingen.cfg");
idConfigFile = new File(configpath + "ids.cfg");

View file

@ -14,11 +14,7 @@ public class BOPConfigurationMain
{
public static Configuration config;
// Configuration variables
public static boolean realisticTrees;
public static Property seenVersion;
public static Property seenWorldTypeMsg;
public static void init(File configFile)
{
@ -28,11 +24,7 @@ public class BOPConfigurationMain
{
config.load();
//realisticTrees = config.get("Biome Settings", "Realistic Trees", true).getBoolean(true);
realisticTrees = false;
seenVersion = config.get("Vars", "Seen Version", "null");
seenWorldTypeMsg = config.get("Vars", "Seen WorldType Msg", false);
FMLCommonHandler.instance().getFMLLogger().log(Level.INFO, "[BiomesOPlenty] Generated Main Config!");
}

View file

@ -55,6 +55,7 @@ public class BOPConfigurationMisc
skyColors = config.get("Hard-Coded Colors", "Enable Sky Colors", true).getBoolean(false);
spawnSearchRadius = config.get("Spawn Settings", "Spawn Location Search Radius", 1024, "Must be 256 or higher").getInt();
if (spawnSearchRadius < 256) spawnSearchRadius = 256;
onlySpawnOnBeaches = config.get("Spawn Settings", "Only Spawn On Beaches", true).getBoolean(true);
promisedLandSkyColor = config.get("Hard-Coded Colors", "Promised Land Sky Color", 5883101, null).getInt();

View file

@ -14,19 +14,9 @@ public class BOPConfigurationTerrainGen
public static Configuration config;
public static int biomeSize;
public static boolean addToDefault;
//public static boolean addToDefault;
public static boolean vanillaEnhanced;
public static boolean netherOverride;
public static boolean stoneFormationGen;
public static boolean pumpkinGen;
public static boolean poisonIvyGen;
public static boolean thornGen;
public static boolean springWaterGen;
public static boolean poisonWaterGen;
public static boolean quicksandGen;
public static boolean exposedStone;
public static boolean witherWartGen;
public static boolean burningBlossomGen;
public static int villageDistance;
public static int landmassPercentage;
@ -126,25 +116,12 @@ public class BOPConfigurationTerrainGen
config.load();
biomeSize = config.get("Biomes O\' Plenty World Type Settings", "Biome Size", 4, "Default World Type has 4. Large Biomes World Type has 6.").getInt(4);
addToDefault = config.get("Biome Settings", "Add Biomes To Default World", false).getBoolean(true);
//addToDefault = config.get("Biome Settings", "Add Biomes To Default World", false).getBoolean(true);
vanillaEnhanced = config.get("Biome Settings", "Enhanced Vanilla Biomes", true).getBoolean(false);
netherOverride = config.get("Dimension Settings", "Enable Nether Override", true).getBoolean(true);
pumpkinGen = config.get("Decoration Settings", "Generate Pumpkins Without Faces", true).getBoolean(true);
stoneFormationGen = config.get("Decoration Settings", "Generate Stone Formations", true, "Stalagmites, stalactites, etc.").getBoolean(true);
poisonIvyGen = config.get("Decoration Settings", "Generate Poison Ivy", true).getBoolean(true);
thornGen = config.get("Decoration Settings", "Generate Thorns", true).getBoolean(true);
springWaterGen = config.get("Decoration Settings", "Generate Hot Springs", true).getBoolean(true);
poisonWaterGen = config.get("Decoration Settings", "Generate Poison Pools", true).getBoolean(true);
quicksandGen = config.get("Decoration Settings", "Generate Quicksand", true).getBoolean(true);
witherWartGen = config.get("Decoration Settings", "Generate Wither Wart", true).getBoolean(true);
burningBlossomGen = config.get("Decoration Settings", "Generate Burning Blossoms", true).getBoolean(true);
exposedStone = config.get("Decoration Settings", "Generate Sections Of Exposed Stone", true).getBoolean(true);
villageDistance = config.get("Biomes O\' Plenty World Type Settings", "Distance between villages", 32, "In Vanilla it is set to 32").getInt();
if (villageDistance < 8)
{
villageDistance = 8;
}
if (villageDistance < 8) villageDistance = 8;
landmassPercentage = config.get("Biomes O\' Plenty World Type Settings", "Landmass Percentage", 10, "In Vanilla it is set to 10. Takes values from 0 to 100.").getInt();

View file

@ -0,0 +1,55 @@
package biomesoplenty.common.configuration;
import java.io.File;
import java.util.ArrayList;
import java.util.Map.Entry;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.common.config.Configuration;
import org.apache.logging.log4j.Level;
import biomesoplenty.common.world.generation.WorldGenFieldAssociation;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
public class BOPConfigurationWorldFeatures
{
public static Configuration config;
public static void init(File configFile)
{
config = new Configuration(configFile);
try
{
config.load();
for (Entry<String, WorldGenerator> entry : WorldGenFieldAssociation.worldGeneratorMap.entrySet())
{
String key = entry.getKey();
boolean featureEnabled = true;
featureEnabled = config.get("World Features", key.replace("PerChunk", "Generation"), true).getBoolean(true);
if (!featureEnabled)
{
WorldGenFieldAssociation.worldGeneratorMap.remove(key);
}
}
FMLCommonHandler.instance().getFMLLogger().log(Level.INFO, "[BiomesOPlenty] Generated World Features Config!");
}
catch (Exception e)
{
FMLLog.log(Level.ERROR, "Biomes O Plenty has had a problem loading its configuration", e);
}
finally
{
if (config.hasChanged()) {
config.save();
}
}
}
}

View file

@ -18,7 +18,7 @@ public class WorldChunkManagerBOP extends WorldChunkManager
@Override
public ChunkPosition func_150795_a(int x, int z, int radius, List biomesToSpawnIn, Random random)
{
int spawnSearchRadius = BOPConfigurationMisc.spawnSearchRadius >= 256 ? BOPConfigurationMisc.spawnSearchRadius : 256;
int spawnSearchRadius = BOPConfigurationMisc.spawnSearchRadius;
return super.func_150795_a(x, z, spawnSearchRadius, biomesToSpawnIn, random);
}

View file

@ -8,6 +8,7 @@ import net.minecraft.world.gen.feature.WorldGenLiquids;
import net.minecraft.world.gen.feature.WorldGenMelon;
import net.minecraft.world.gen.feature.WorldGenerator;
import biomesoplenty.api.BOPBlockHelper;
import biomesoplenty.common.configuration.BOPConfigurationWorldFeatures;
import biomesoplenty.common.world.features.WorldGenBOPDoubleFlora;
import biomesoplenty.common.world.features.WorldGenBOPFlora;
import biomesoplenty.common.world.features.WorldGenBOPTallGrass;