Fixed a bug with config options

This commit is contained in:
Adubbz 2014-04-01 20:33:59 +11:00
parent b7b08d205e
commit ada18c601d
6 changed files with 119 additions and 11 deletions

View file

@ -1,13 +1,10 @@
package biomesoplenty.common.configuration; package biomesoplenty.common.configuration;
import java.io.File; import cpw.mods.fml.common.FMLLog;
import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Configuration;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import cpw.mods.fml.common.FMLCommonHandler; import java.io.File;
import cpw.mods.fml.common.FMLLog;
public class BOPConfigurationMisc public class BOPConfigurationMisc
{ {
@ -16,6 +13,9 @@ public class BOPConfigurationMisc
public static boolean skyColors; public static boolean skyColors;
//public static boolean achievements; //public static boolean achievements;
public static boolean dungeonLoot; public static boolean dungeonLoot;
public static boolean hotSpringsRegeneration;
public static boolean behaveNormally;
public static boolean amethystTools; public static boolean amethystTools;
public static boolean mudTools; public static boolean mudTools;
@ -23,8 +23,7 @@ public class BOPConfigurationMisc
public static boolean staffCrafting; public static boolean staffCrafting;
public static boolean enderporterCrafting; public static boolean enderporterCrafting;
public static boolean dartCrafting; public static boolean dartCrafting;
public static boolean flowerbandCrafting; public static boolean flowerbandCrafting;
public static boolean hotSpringsRegeneration;
public static int promisedLandSkyColor; public static int promisedLandSkyColor;
@ -42,6 +41,7 @@ public class BOPConfigurationMisc
//achievements = config.get("Miscellanious Settings", "Add Biomes O\' Plenty Achievements", true).getBoolean(false); //achievements = config.get("Miscellanious Settings", "Add Biomes O\' Plenty Achievements", true).getBoolean(false);
dungeonLoot = config.get("Miscellanious Settings", "Add Custom Dungeon Loot", true).getBoolean(false); dungeonLoot = config.get("Miscellanious Settings", "Add Custom Dungeon Loot", true).getBoolean(false);
hotSpringsRegeneration = config.get("Miscellanious Settings", "Enable Spring Water Regeneration Effect", true).getBoolean(true); hotSpringsRegeneration = config.get("Miscellanious Settings", "Enable Spring Water Regeneration Effect", true).getBoolean(true);
hotSpringsRegeneration = config.get("Miscellanious Settings", "Behave Normally During Special Events", false).getBoolean(false);
amethystTools = config.get("Crafting Settings", "Enable Amethyst Tool/Armor Crafting", true).getBoolean(true); amethystTools = config.get("Crafting Settings", "Enable Amethyst Tool/Armor Crafting", true).getBoolean(true);
mudTools = config.get("Crafting Settings", "Enable Mud Tool/Armor Crafting", true).getBoolean(true); mudTools = config.get("Crafting Settings", "Enable Mud Tool/Armor Crafting", true).getBoolean(true);

View file

@ -21,7 +21,7 @@ public class BOPBiomes
public static WorldTypeBOP worldTypeBOP; public static WorldTypeBOP worldTypeBOP;
public static BOPBiomeEntry onlyBiome; public static BOPBiomeEntry onlyBiome;
public static void init() public static void init()
{ {
GameRegistry.registerWorldGenerator(new BOPDecorationManager(), 0); GameRegistry.registerWorldGenerator(new BOPDecorationManager(), 0);

View file

@ -1,12 +1,12 @@
package biomesoplenty.common.world; package biomesoplenty.common.world;
import biomesoplenty.common.configuration.BOPConfigurationMisc;
import biomesoplenty.common.world.layer.GenLayerBiomeBOP; import biomesoplenty.common.world.layer.GenLayerBiomeBOP;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldType; import net.minecraft.world.WorldType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.WorldChunkManager; import net.minecraft.world.biome.WorldChunkManager;
import net.minecraft.world.biome.WorldChunkManagerHell;
import net.minecraft.world.gen.FlatGeneratorInfo;
import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.GenLayerBiomeEdge; import net.minecraft.world.gen.layer.GenLayerBiomeEdge;
import net.minecraft.world.gen.layer.GenLayerZoom; import net.minecraft.world.gen.layer.GenLayerZoom;
@ -14,9 +14,13 @@ import net.minecraftforge.common.DimensionManager;
public class WorldTypeBOP extends WorldType public class WorldTypeBOP extends WorldType
{ {
public static WorldTypeBOPA worldTypeBOPA;
public WorldTypeBOP() public WorldTypeBOP()
{ {
super("BIOMESOP"); super("BIOMESOP");
worldTypeBOPA = new WorldTypeBOPA();
DimensionManager.unregisterProviderType(0); DimensionManager.unregisterProviderType(0);
DimensionManager.registerProviderType(0, WorldProviderSurfaceBOP.class, true); DimensionManager.registerProviderType(0, WorldProviderSurfaceBOP.class, true);
@ -26,6 +30,7 @@ public class WorldTypeBOP extends WorldType
public GenLayer getBiomeLayer(long worldSeed, GenLayer parentLayer) public GenLayer getBiomeLayer(long worldSeed, GenLayer parentLayer)
{ {
GenLayer ret = new GenLayerBiomeBOP(200L, parentLayer, this); GenLayer ret = new GenLayerBiomeBOP(200L, parentLayer, this);
ret = GenLayerZoom.magnify(1000L, ret, 2); ret = GenLayerZoom.magnify(1000L, ret, 2);
ret = new GenLayerBiomeEdge(1000L, ret); ret = new GenLayerBiomeEdge(1000L, ret);
return ret; return ret;
@ -36,4 +41,12 @@ public class WorldTypeBOP extends WorldType
{ {
return new WorldChunkManagerBOP(world); return new WorldChunkManagerBOP(world);
} }
@Override
@SideOnly(Side.CLIENT)
public boolean getCanBeCreated()
{
if (!BOPConfigurationMisc.behaveNormally) return !WorldTypeBOPA.isTime();
else return true;
}
} }

View file

@ -0,0 +1,59 @@
package biomesoplenty.common.world;
import biomesoplenty.common.biomes.overworld.BiomeGenCandyland;
import biomesoplenty.common.configuration.BOPConfigurationIDs;
import biomesoplenty.common.configuration.BOPConfigurationMisc;
import biomesoplenty.common.world.layer.GenLayerBiomeBOPA;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.world.World;
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.WorldChunkManager;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.GenLayerBiomeEdge;
import net.minecraft.world.gen.layer.GenLayerZoom;
import java.util.Calendar;
public class WorldTypeBOPA extends WorldType
{
public static BiomeGenCandyland candyland;
public WorldTypeBOPA()
{
super("CANDYOP");
candyland = new BiomeGenCandyland(BOPConfigurationIDs.candylandID);
}
@Override
public GenLayer getBiomeLayer(long worldSeed, GenLayer parentLayer)
{
GenLayer ret = new GenLayerBiomeBOPA(200L, parentLayer, this);
ret = GenLayerZoom.magnify(1000L, ret, 2);
ret = new GenLayerBiomeEdge(1000L, ret);
return ret;
}
@Override
public WorldChunkManager getChunkManager(World world)
{
return new WorldChunkManagerBOP(world);
}
@Override
@SideOnly(Side.CLIENT)
public boolean getCanBeCreated()
{
if (!BOPConfigurationMisc.behaveNormally) return WorldTypeBOPA.isTime();
else return false;
}
public static boolean isTime()
{
Calendar calendar = Calendar.getInstance();
return (calendar.get(2) + 1 == 4 && calendar.get(5) == 1);
}
}

View file

@ -0,0 +1,35 @@
package biomesoplenty.common.world.layer;
import biomesoplenty.common.world.WorldTypeBOPA;
import net.minecraft.world.WorldType;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.GenLayerBiome;
import net.minecraft.world.gen.layer.IntCache;
public class GenLayerBiomeBOPA extends GenLayerBiome
{
public GenLayerBiomeBOPA(long seed, GenLayer parentLayer, WorldType worldType)
{
super(seed, parentLayer, worldType);
}
@Override
public int[] getInts(int par1, int par2, int par3, int par4)
{
int[] aint = this.parent.getInts(par1, par2, par3, par4);
int[] aint1 = IntCache.getIntCache(par3 * par4);
for (int i1 = 0; i1 < par4; ++i1)
{
for (int j1 = 0; j1 < par3; ++j1)
{
this.initChunkSeed((long)(j1 + par1), (long)(i1 + par2));
aint1[j1 + i1 * par3] = WorldTypeBOPA.candyland.biomeID;
}
}
return aint1;
}
}

View file

@ -473,3 +473,4 @@ achievement.bop.achAllBOP.desc=You got all of the Biomes O' Plenty achievements!
itemGroup.tabBiomesOPlenty=Biomes O' Plenty itemGroup.tabBiomesOPlenty=Biomes O' Plenty
generator.BIOMESOP=Biomes O' Plenty generator.BIOMESOP=Biomes O' Plenty
generator.CANDYOP=Biomes O' Plenty