diff --git a/src/main/java/forestry/Forestry.java b/src/main/java/forestry/Forestry.java index 0d81c8d32..cdf349958 100644 --- a/src/main/java/forestry/Forestry.java +++ b/src/main/java/forestry/Forestry.java @@ -63,7 +63,6 @@ import forestry.core.utils.StringUtil; + "after:IC2@[2.0.140,);" + "after:Natura@[2.2.0,);" + "after:HardcoreEnderExpansion;") -//, certificateFingerprint = Version.FINGERPRINT) public class Forestry { @Mod.Instance(Defaults.MOD) diff --git a/src/main/java/forestry/apiculture/worldgen/HiveDecorator.java b/src/main/java/forestry/apiculture/worldgen/HiveDecorator.java index 61a813b7b..92eaba018 100755 --- a/src/main/java/forestry/apiculture/worldgen/HiveDecorator.java +++ b/src/main/java/forestry/apiculture/worldgen/HiveDecorator.java @@ -73,7 +73,7 @@ public class HiveDecorator { } public boolean genHive(World world, Random rand, int chunkX, int chunkZ, Hive hive) { - if (hive.genChance() * Config.getBeehivesRate() < rand.nextFloat() * 100.0f) { + if (hive.genChance() * Config.getBeehivesAmount() < rand.nextFloat() * 100.0f) { return false; } diff --git a/src/main/java/forestry/core/ForestryCore.java b/src/main/java/forestry/core/ForestryCore.java index 68a8ff71d..bf3b3ea6c 100755 --- a/src/main/java/forestry/core/ForestryCore.java +++ b/src/main/java/forestry/core/ForestryCore.java @@ -50,9 +50,6 @@ public class ForestryCore { MinecraftForge.EVENT_BUS.register(new EventHandlerCore()); Config.load(); - if (!Config.disableVersionCheck) { - Version.versionCheck(); - } EnumErrorCode.init(); diff --git a/src/main/java/forestry/core/GameMode.java b/src/main/java/forestry/core/GameMode.java index dcb5a214b..05f8f856c 100755 --- a/src/main/java/forestry/core/GameMode.java +++ b/src/main/java/forestry/core/GameMode.java @@ -10,18 +10,22 @@ ******************************************************************************/ package forestry.core; +import java.io.File; import java.util.HashMap; +import java.util.Map; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.config.Property; + +import forestry.Forestry; import forestry.api.core.ForestryAPI; import forestry.api.core.IGameMode; import forestry.core.config.Config; -import forestry.core.config.Configuration; import forestry.core.config.ForestryBlock; import forestry.core.config.ForestryItem; -import forestry.core.config.Property; import forestry.core.proxy.Proxies; public class GameMode implements IGameMode { @@ -38,10 +42,10 @@ public class GameMode implements IGameMode { private String identifier = "EASY"; private final String category; - private final HashMap booleanSettings = new HashMap(); - private final HashMap integerSettings = new HashMap(); - private final HashMap floatSettings = new HashMap(); - private final HashMap stackSettings = new HashMap(); + private final Map booleanSettings = new HashMap(); + private final Map integerSettings = new HashMap(); + private final Map floatSettings = new HashMap(); + private final Map stackSettings = new HashMap(); private static final float ENERGY_DEMAND_MODIFIER = 1.0f; private static final float FUEL_MODIFIER = 1.0f; @@ -84,60 +88,167 @@ public class GameMode implements IGameMode { this.identifier = identifier; this.category = "gamemodes/" + identifier; - Configuration config = Config.config; + final String oldConfig = category + ".conf"; + final String newConfig = category + ".cfg"; + File newConfigFile = new File(Forestry.instance.getConfigFolder(), newConfig); + File oldConfigFile = new File(Forestry.instance.getConfigFolder(), oldConfig); + if (oldConfigFile.exists()) { + loadOldConfig(); - initSetting("energy.demand.modifier", ENERGY_DEMAND_MODIFIER, -1, "modifies the energy required to activate machines, as well as the max amount of energy stored and accepted."); - initSetting("farms.fertilizer.value", FARM_FERTILIZER_VALUE, -1, "modifies the time a piece of fertilizer lasts in a farm."); + final String oldConfigRenamed = category + ".conf.old"; + File oldConfigFileRenamed = new File(Forestry.instance.getConfigFolder(), oldConfigRenamed); + if (oldConfigFile.renameTo(oldConfigFileRenamed)) { + Proxies.log.info("Migrated " + category + " settings to the new file '" + newConfig + "' and renamed '" + oldConfig + "' to '" + oldConfigRenamed + "'."); + } + } - initSetting("fuel.ethanol.generator", FUEL_MODIFIER, -1, "modifies the energy provided by ethanol in a Bio Generator."); - initSetting("fuel.ethanol.combustion", FUEL_MODIFIER, -1, "modifies the energy provided by ethanol in Buildcraft Combustion Engines."); - initSetting("fuel.biomass.generator", FUEL_MODIFIER, -1, "modifies the energy provided by Biomass in a Bio Generator."); - initSetting("fuel.biomass.biogas", FUEL_MODIFIER, -1, "modifies the energy provided by Biomass in Biogas Engines."); + Configuration config = new Configuration(newConfigFile); - initSetting("recipe.output.fertilizer.apatite", recipeFertilizerOutputApatite, "amount of fertilizer yielded by the recipe using apatite."); - initSetting("recipe.output.fertilizer.ash", recipeFertilizerOutputAsh, "amount of fertilizer yielded by the recipe using ash."); - initSetting("recipe.output.compost.wheat", recipeCompostOutputWheat, "amount of compost yielded by the recipe using wheat."); - initSetting("recipe.output.compost.ash", recipeCompostOutputAsh, "amount of compost yielded by the recipe using ash."); - initSetting("recipe.output.humus.fertilizer", recipeHumusOutputFertilizer, "amount of humus yielded by the recipe using fertilizer."); - initSetting("recipe.output.humus.compost", recipeHumusOutputCompost, "amount of humus yielded by the recipe using compost."); - initSetting("recipe.output.bogearth.bucket", recipeBogEarthOutputBucket, "amount of bog earth yielded by the recipe using buckets."); - initSetting("recipe.output.bogearth.can", recipeBogEarthOutputCans, "amount of bog earth yielded by the recipes using cans, cells or capsules."); + initSettingFloat(config, "energy", "demand.modifier", ENERGY_DEMAND_MODIFIER, "modifies the energy required to activate machines, as well as the max amount of energy stored and accepted."); + initSettingInt(config, "farms", "fertilizer.value", FARM_FERTILIZER_VALUE, "modifies the time a piece of fertilizer lasts in a farm."); - initSetting("recipe.output.can", recipeCanOutput, "amount yielded by the recipe for tin cans."); - initSetting("recipe.output.capsule", recipeCapsuleOutput, "amount yielded by the recipe for wax capsules."); - initSetting("recipe.output.refractory", recipeRefractoryOutput, "amount yielded by the recipe for refractory capsules."); + initSettingFloat(config, "fuel.ethanol", "generator", FUEL_MODIFIER, "modifies the energy provided by ethanol in a Bio Generator."); + initSettingFloat(config, "fuel.ethanol", "combustion", FUEL_MODIFIER, "modifies the energy provided by ethanol in Buildcraft Combustion Engines."); + initSettingFloat(config, "fuel.biomass", "generator", FUEL_MODIFIER, "modifies the energy provided by Biomass in a Bio Generator."); + initSettingFloat(config, "fuel.biomass", "biogas", FUEL_MODIFIER, "modifies the energy provided by Biomass in Biogas Engines."); - initSetting("fermenter.cycles.fertilizer", FERMENTATION_DURATION_FERTILIZER, -1, "modifies the amount of cycles fertilizer can keep a fermenter going."); - initSetting("fermenter.cycles.compost", FERMENTATION_DURATION_COMPOST, -1, "modifies the amount of cycles compost can keep a fermenter going."); + initSettingStack(config, "recipe.output.fertilizer", "apatite", recipeFertilizerOutputApatite, "amount of fertilizer yielded by the recipe using apatite."); + initSettingStack(config, "recipe.output.fertilizer", "ash", recipeFertilizerOutputAsh, "amount of fertilizer yielded by the recipe using ash."); + initSettingStack(config, "recipe.output.compost", "wheat", recipeCompostOutputWheat, "amount of compost yielded by the recipe using wheat."); + initSettingStack(config, "recipe.output.compost", "ash", recipeCompostOutputAsh, "amount of compost yielded by the recipe using ash."); + initSettingStack(config, "recipe.output.humus", "fertilizer", recipeHumusOutputFertilizer, "amount of humus yielded by the recipe using fertilizer."); + initSettingStack(config, "recipe.output.humus", "compost", recipeHumusOutputCompost, "amount of humus yielded by the recipe using compost."); + initSettingStack(config, "recipe.output.bogearth", "bucket", recipeBogEarthOutputBucket, "amount of bog earth yielded by the recipe using buckets."); + initSettingStack(config, "recipe.output.bogearth", "can", recipeBogEarthOutputCans, "amount of bog earth yielded by the recipes using cans, cells or capsules."); - initSetting("fermenter.value.fertilizer", FERMENTED_CYCLE_FERTILIZER, -1, "modifies the amount of biomass per cycle a fermenter will produce using fertilizer."); - initSetting("fermenter.value.compost", FERMENTED_CYCLE_COMPOST, -1, "modifies the amount of biomass per cycle a fermenter will produce using compost."); + initSettingStack(config, "recipe.output", "can", recipeCanOutput, "amount yielded by the recipe for tin cans."); + initSettingStack(config, "recipe.output", "capsule", recipeCapsuleOutput, "amount yielded by the recipe for wax capsules."); + initSettingStack(config, "recipe.output", "refractory", recipeRefractoryOutput, "amount yielded by the recipe for refractory capsules."); - initSetting("fermenter.yield.sapling", FERMENTED_SAPLING, FERMENTED_SAPLING * 8, "modifies the base amount of biomass a sapling will yield in a fermenter, affected by sappiness trait."); - initSetting("fermenter.yield.cactus", FERMENTED_CACTI, FERMENTED_CACTI * 8, "modifies the amount of biomass a piece of cactus will yield in a fermenter."); - initSetting("fermenter.yield.wheat", FERMENTED_WHEAT, FERMENTED_WHEAT * 8, "modifies the amount of biomass a piece of wheat will yield in a fermenter."); - initSetting("fermenter.yield.cane", FERMENTED_CANE, FERMENTED_CANE * 8, "modifies the amount of biomass a piece of sugar cane will yield in a fermenter."); - initSetting("fermenter.yield.mushroom", FERMENTED_MUSHROOM, FERMENTED_MUSHROOM * 8, "modifies the amount of biomass a mushroom will yield in a fermenter."); + initSettingInt(config, "fermenter.cycles", "fertilizer", FERMENTATION_DURATION_FERTILIZER, "modifies the amount of cycles fertilizer can keep a fermenter going."); + initSettingInt(config, "fermenter.cycles", "compost", FERMENTATION_DURATION_COMPOST, "modifies the amount of cycles compost can keep a fermenter going."); - initSetting("squeezer.liquid.seed", SQUEEZED_LIQUID_SEED, SQUEEZED_LIQUID_SEED * 8, "modifies the amount of seed oil squeezed from a single seed. other sources are based off this."); - initSetting("squeezer.liquid.apple", SQUEEZED_LIQUID_APPLE, SQUEEZED_LIQUID_APPLE * 8, "modifies the amount of juice squeezed from a single apple. other sources are based off this."); - initSetting("squeezer.mulch.apple", SQUEEZED_MULCH_APPLE, SQUEEZED_MULCH_APPLE * 8, "modifies the chance of mulch per squeezed apple."); - initSetting("energy.engine.clockwork", true, "set to false to disable the clockwork engine."); + initSettingInt(config, "fermenter.value", "fertilizer", FERMENTED_CYCLE_FERTILIZER, "modifies the amount of biomass per cycle a fermenter will produce using fertilizer."); + initSettingInt(config, "fermenter.value", "compost", FERMENTED_CYCLE_COMPOST, "modifies the amount of biomass per cycle a fermenter will produce using compost."); + + initSettingInt(config, "fermenter.yield", "sapling", FERMENTED_SAPLING, "modifies the base amount of biomass a sapling will yield in a fermenter, affected by sappiness trait."); + initSettingInt(config, "fermenter.yield", "cactus", FERMENTED_CACTI, "modifies the amount of biomass a piece of cactus will yield in a fermenter."); + initSettingInt(config, "fermenter.yield", "wheat", FERMENTED_WHEAT, "modifies the amount of biomass a piece of wheat will yield in a fermenter."); + initSettingInt(config, "fermenter.yield", "cane", FERMENTED_CANE, "modifies the amount of biomass a piece of sugar cane will yield in a fermenter."); + initSettingInt(config, "fermenter.yield", "mushroom", FERMENTED_MUSHROOM, "modifies the amount of biomass a mushroom will yield in a fermenter."); + + initSettingInt(config, "squeezer.liquid", "seed", SQUEEZED_LIQUID_SEED, "modifies the amount of seed oil squeezed from a single seed. other sources are based off this."); + initSettingInt(config, "squeezer.liquid", "apple", SQUEEZED_LIQUID_APPLE, "modifies the amount of juice squeezed from a single apple. other sources are based off this."); + initSettingInt(config, "squeezer.mulch", "apple", SQUEEZED_MULCH_APPLE, "modifies the chance of mulch per squeezed apple."); + initSettingBoolean(config, "energy", "engine.clockwork", true, "set to false to disable the clockwork engine."); config.save(); - } - private void initSetting(String ident, ItemStack def, String comment) { - Property property = Config.config.get(ident, category, def.stackSize); + private void loadOldConfig() { + initSettingFloat_old("energy.demand.modifier", ENERGY_DEMAND_MODIFIER, -1, "modifies the energy required to activate machines, as well as the max amount of energy stored and accepted."); + initSettingInt_old("farms.fertilizer.value", FARM_FERTILIZER_VALUE, -1, "modifies the time a piece of fertilizer lasts in a farm."); + + initSettingFloat_old("fuel.ethanol.generator", FUEL_MODIFIER, -1, "modifies the energy provided by ethanol in a Bio Generator."); + initSettingFloat_old("fuel.ethanol.combustion", FUEL_MODIFIER, -1, "modifies the energy provided by ethanol in Buildcraft Combustion Engines."); + initSettingFloat_old("fuel.biomass.generator", FUEL_MODIFIER, -1, "modifies the energy provided by Biomass in a Bio Generator."); + initSettingFloat_old("fuel.biomass.biogas", FUEL_MODIFIER, -1, "modifies the energy provided by Biomass in Biogas Engines."); + + initSettingStack_old("recipe.output.fertilizer.apatite", recipeFertilizerOutputApatite, "amount of fertilizer yielded by the recipe using apatite."); + initSettingStack_old("recipe.output.fertilizer.ash", recipeFertilizerOutputAsh, "amount of fertilizer yielded by the recipe using ash."); + initSettingStack_old("recipe.output.compost.wheat", recipeCompostOutputWheat, "amount of compost yielded by the recipe using wheat."); + initSettingStack_old("recipe.output.compost.ash", recipeCompostOutputAsh, "amount of compost yielded by the recipe using ash."); + initSettingStack_old("recipe.output.humus.fertilizer", recipeHumusOutputFertilizer, "amount of humus yielded by the recipe using fertilizer."); + initSettingStack_old("recipe.output.humus.compost", recipeHumusOutputCompost, "amount of humus yielded by the recipe using compost."); + initSettingStack_old("recipe.output.bogearth.bucket", recipeBogEarthOutputBucket, "amount of bog earth yielded by the recipe using buckets."); + initSettingStack_old("recipe.output.bogearth.can", recipeBogEarthOutputCans, "amount of bog earth yielded by the recipes using cans, cells or capsules."); + + initSettingStack_old("recipe.output.can", recipeCanOutput, "amount yielded by the recipe for tin cans."); + initSettingStack_old("recipe.output.capsule", recipeCapsuleOutput, "amount yielded by the recipe for wax capsules."); + initSettingStack_old("recipe.output.refractory", recipeRefractoryOutput, "amount yielded by the recipe for refractory capsules."); + + initSettingInt_old("fermenter.cycles.fertilizer", FERMENTATION_DURATION_FERTILIZER, -1, "modifies the amount of cycles fertilizer can keep a fermenter going."); + initSettingInt_old("fermenter.cycles.compost", FERMENTATION_DURATION_COMPOST, -1, "modifies the amount of cycles compost can keep a fermenter going."); + + initSettingInt_old("fermenter.value.fertilizer", FERMENTED_CYCLE_FERTILIZER, -1, "modifies the amount of biomass per cycle a fermenter will produce using fertilizer."); + initSettingInt_old("fermenter.value.compost", FERMENTED_CYCLE_COMPOST, -1, "modifies the amount of biomass per cycle a fermenter will produce using compost."); + + initSettingInt_old("fermenter.yield.sapling", FERMENTED_SAPLING, FERMENTED_SAPLING * 8, "modifies the base amount of biomass a sapling will yield in a fermenter, affected by sappiness trait."); + initSettingInt_old("fermenter.yield.cactus", FERMENTED_CACTI, FERMENTED_CACTI * 8, "modifies the amount of biomass a piece of cactus will yield in a fermenter."); + initSettingInt_old("fermenter.yield.wheat", FERMENTED_WHEAT, FERMENTED_WHEAT * 8, "modifies the amount of biomass a piece of wheat will yield in a fermenter."); + initSettingInt_old("fermenter.yield.cane", FERMENTED_CANE, FERMENTED_CANE * 8, "modifies the amount of biomass a piece of sugar cane will yield in a fermenter."); + initSettingInt_old("fermenter.yield.mushroom", FERMENTED_MUSHROOM, FERMENTED_MUSHROOM * 8, "modifies the amount of biomass a mushroom will yield in a fermenter."); + + initSettingInt_old("squeezer.liquid.seed", SQUEEZED_LIQUID_SEED, SQUEEZED_LIQUID_SEED * 8, "modifies the amount of seed oil squeezed from a single seed. other sources are based off this."); + initSettingInt_old("squeezer.liquid.apple", SQUEEZED_LIQUID_APPLE, SQUEEZED_LIQUID_APPLE * 8, "modifies the amount of juice squeezed from a single apple. other sources are based off this."); + initSettingInt_old("squeezer.mulch.apple", SQUEEZED_MULCH_APPLE, SQUEEZED_MULCH_APPLE * 8, "modifies the chance of mulch per squeezed apple."); + initSettingBoolean_old("energy.engine.clockwork", true, "set to false to disable the clockwork engine."); + } + + private void initSettingFloat(Configuration config, String category, String key, double def, String comment) { + String fullKey = category + '.' + key; + // legacy conversion of old format to new format + { + Float oldSetting = floatSettings.get(fullKey); + if (oldSetting != null) { + def = oldSetting; + } + } + Property property = config.get(category, key, def, comment); + floatSettings.put(fullKey, (float) property.getDouble()); + } + + private void initSettingInt(Configuration config, String category, String key, int def, String comment) { + String fullKey = category + '.' + key; + // legacy conversion of old format to new format + { + Integer oldSetting = integerSettings.get(fullKey); + if (oldSetting != null) { + def = oldSetting; + } + } + Property property = config.get(category, key, def, comment); + integerSettings.put(fullKey, property.getInt()); + } + + private void initSettingStack(Configuration config, String category, String key, ItemStack def, String comment) { + String fullKey = category + '.' + key; + // legacy conversion of old format to new format + { + ItemStack oldSetting = stackSettings.get(fullKey); + if (oldSetting != null) { + def = oldSetting; + } + } + Property property = config.get(category, key, def.stackSize, comment); + ItemStack changed = def.copy(); + changed.stackSize = property.getInt(); + stackSettings.put(fullKey, changed); + } + + private void initSettingBoolean(Configuration config, String category, String key, boolean def, String comment) { + String fullKey = category + '.' + key; + // legacy conversion of old format to new format + { + Boolean oldSetting = booleanSettings.get(fullKey); + if (oldSetting != null) { + def = oldSetting; + } + } + Property property = config.get(category, key, def, comment); + booleanSettings.put(fullKey, property.getBoolean()); + } + + private void initSettingStack_old(String ident, ItemStack def, String comment) { + forestry.core.config.deprecated.Property property = Config.configOld.get(ident, category, def.stackSize); property.comment = comment; ItemStack changed = def.copy(); changed.stackSize = Integer.parseInt(property.value); stackSettings.put(ident, changed); } - private void initSetting(String ident, int def, int max, String comment) { - Property property = Config.config.get(ident, category, def); + private void initSettingInt_old(String ident, int def, int max, String comment) { + forestry.core.config.deprecated.Property property = Config.configOld.get(ident, category, def); if (max < 0) { property.comment = comment; integerSettings.put(ident, Integer.parseInt(property.value)); @@ -145,12 +256,12 @@ public class GameMode implements IGameMode { property.comment = comment + " (max: " + max + ")"; integerSettings.put(ident, Math.min(Integer.parseInt(property.value), max)); } - Config.config.set(ident, category, integerSettings.get(ident)); + Config.configOld.set(ident, category, integerSettings.get(ident)); } - private void initSetting(String ident, float def, float max, String comment) { - Property property = Config.config.get(ident, category, def); + private void initSettingFloat_old(String ident, float def, float max, String comment) { + forestry.core.config.deprecated.Property property = Config.configOld.get(ident, category, def); if (max < 0) { property.comment = comment; floatSettings.put(ident, Float.parseFloat(property.value)); @@ -158,14 +269,14 @@ public class GameMode implements IGameMode { property.comment = comment + " (max: " + max + ")"; floatSettings.put(ident, Math.min(Float.parseFloat(property.value), max)); } - Config.config.set(ident, category, floatSettings.get(ident)); + Config.configOld.set(ident, category, floatSettings.get(ident)); } - private void initSetting(String ident, boolean def, String comment) { - Property property = Config.config.get(ident, category, def); + private void initSettingBoolean_old(String ident, boolean def, String comment) { + forestry.core.config.deprecated.Property property = Config.configOld.get(ident, category, def); property.comment = comment; booleanSettings.put(ident, Boolean.parseBoolean(property.value)); - Config.config.set(ident, category, booleanSettings.get(ident)); + Config.configOld.set(ident, category, booleanSettings.get(ident)); } @Override diff --git a/src/main/java/forestry/core/TickHandlerCoreClient.java b/src/main/java/forestry/core/TickHandlerCoreClient.java index 0cb8de299..85975eef1 100755 --- a/src/main/java/forestry/core/TickHandlerCoreClient.java +++ b/src/main/java/forestry/core/TickHandlerCoreClient.java @@ -14,22 +14,18 @@ import java.util.concurrent.ConcurrentLinkedQueue; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent.Phase; import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent; -import forestry.core.config.Config; -import forestry.core.config.Version; import forestry.core.proxy.Proxies; import forestry.core.utils.GeneticsUtil; public class TickHandlerCoreClient { private static final ConcurrentLinkedQueue messages = new ConcurrentLinkedQueue(); - private boolean naggedVersion, naggedVerify; private boolean hasNaturalistView; public TickHandlerCoreClient() { @@ -61,17 +57,5 @@ public class TickHandlerCoreClient { player.addChatMessage(new ChatComponentText(message)); } } - - if (!naggedVersion && !Config.disableVersionCheck && Version.needsUpdateNoticeAndMarkAsSeen()) { - queueChatMessage(EnumChatFormatting.RED + String.format("New version of Forestry available: %s for Minecraft %s", Version.getRecommendedVersion(), - Proxies.common.getMinecraftVersion())); - queueChatMessage(EnumChatFormatting.RED + "This message only displays once. Type '/forestry version' to see the changelog."); - naggedVersion = true; - } - - if (!naggedVerify && Config.invalidFingerprint) { - queueChatMessage(EnumChatFormatting.GOLD + "Forestry's jar file was tampered with. Some machines have shut down and beekeeping has grown dangerous. Get a new jar from the official download page to fix that!"); - naggedVerify = true; - } } } diff --git a/src/main/java/forestry/core/config/Config.java b/src/main/java/forestry/core/config/Config.java index 1c717b425..ae2798a2b 100755 --- a/src/main/java/forestry/core/config/Config.java +++ b/src/main/java/forestry/core/config/Config.java @@ -18,10 +18,14 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; -import java.util.Locale; +import java.util.Map; import java.util.Properties; import java.util.Set; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.config.Property; + +import forestry.Forestry; import forestry.core.fluids.Fluids; import forestry.core.proxy.Proxies; @@ -31,7 +35,7 @@ public class Config { public static final String CATEGORY_FLUIDS = "fluids"; public static final String CATEGORY_DEBUG = "debug"; - public static Configuration config; + public static forestry.core.config.deprecated.Configuration configOld; public static String gameMode; @@ -41,10 +45,7 @@ public class Config { public static boolean isDebug = false; - public static boolean disablePermissions = false; - public static boolean disableVersionCheck = false; - - public static boolean invalidFingerprint = false; + public static boolean enablePermissions = true; // Graphics public static boolean enableParticleFX = true; @@ -59,8 +60,7 @@ public class Config { public static boolean generateApatiteOre = true; public static boolean generateCopperOre = true; public static boolean generateTinOre = true; - public static boolean generateBeehives = true; - private static float generateBeehivesRate = 1.0f; + private static double generateBeehivesAmount = 1.0; public static boolean generateBeehivesDebug = false; public static boolean enableVillager = true; @@ -80,8 +80,8 @@ public class Config { public static final ArrayList collectorStamps = new ArrayList(); public static boolean squareFarms = false; - public static boolean ExUtilEnderLily = true; - public static boolean MagicalCropsSupport = true; + public static boolean enableExUtilEnderLily = true; + public static boolean enableMagicalCropsSupport = true; // Mail public static boolean mailAlertEnabled = true; @@ -90,8 +90,8 @@ public class Config { public static int guiTabSpeed = 8; // Hints - public static boolean disableHints = false; - public static final HashMap hints = new HashMap(); + public static boolean enableHints = true; + public static final Map hints = new HashMap(); public static boolean enableEnergyStat = true; public static boolean isStructureEnabled(String uid) { @@ -110,217 +110,401 @@ public class Config { return craftingBronzeEnabled; } - public static float getBeehivesRate() { - return generateBeehivesRate; + public static double getBeehivesAmount() { + return generateBeehivesAmount; } public static boolean isExUtilEnderLilyEnabled() { - return ExUtilEnderLily; + return enableExUtilEnderLily; } public static boolean isMagicalCropsSupportEnabled() { - return MagicalCropsSupport; + return enableMagicalCropsSupport; } public static void load() { - setDebugMode(); + configOld = new forestry.core.config.deprecated.Configuration(); - config = new Configuration(); - config.addPurge("buildcraft.blockid.engine"); - config.addPurge("buildcraft.blockid.pipe"); - config.addPurge("crafting.farms.enabled"); - config.addPurge("crafting.farms.uncrafting.enabled"); - config.addPurge("performance.planter"); - config.addPurge("performance.harvester"); - config.addPurge("buildcraft.ignore"); - config.addPurge("power.framework"); + final String oldConfigCommon = CATEGORY_COMMON + ".conf"; + final String newConfigCommon = CATEGORY_COMMON + ".cfg"; + File newConfigCommonFile = new File(Forestry.instance.getConfigFolder(), newConfigCommon); + File oldConfigCommonFile = new File(Forestry.instance.getConfigFolder(), oldConfigCommon); + if (oldConfigCommonFile.exists()) { + loadOldConfigCommon(); - loadModes(); - loadFluids(); - - Property property; - - Property particleFX = config.get("performance.particleFX.enabled", CATEGORY_COMMON, true); - particleFX.comment = "set to false to disable particle fx on slower machines"; - enableParticleFX = Boolean.parseBoolean(particleFX.value); - - // RetroGen - - String retroGenMessage = "Forestry will attempt worldGen in chunks that were created before the mod was added."; - Property retroGen = config.get("world.retrogen.normal", CATEGORY_COMMON, false); - retroGen.comment = "Set to true, " + retroGenMessage; - doRetrogen = Boolean.parseBoolean(retroGen.value); - - String forcedRetroGenMessage = "Forestry will attempt worldGen in all chunks for this game instance. Config option will be set to false after this run."; - String forcedRetroGenKey = "world.retrogen.forced"; - Property forceRetroGen = config.get(forcedRetroGenKey, CATEGORY_COMMON, false); - forceRetroGen.comment = "Set to true, " + forcedRetroGenMessage; - forceRetrogen = Boolean.parseBoolean(forceRetroGen.value); - - if (forceRetrogen) { - Proxies.log.info(forcedRetroGenMessage); - config.set(forcedRetroGenKey, CATEGORY_COMMON, false); - doRetrogen = true; - } else if (doRetrogen) { - Proxies.log.info(retroGenMessage); + final String oldConfigRenamed = CATEGORY_COMMON + ".conf.old"; + File oldConfigFileRenamed = new File(Forestry.instance.getConfigFolder(), oldConfigRenamed); + if (oldConfigCommonFile.renameTo(oldConfigFileRenamed)) { + Proxies.log.info("Migrated " + CATEGORY_COMMON + " settings to the new file '" + newConfigCommon + "' and renamed '" + oldConfigCommon + "' to '" + oldConfigRenamed + "'."); + } } + loadNewConfigCommon(newConfigCommonFile); - Property genApatiteOre = config.get("world.generate.apatite", CATEGORY_COMMON, true); - genApatiteOre.comment = "set to false to force forestry to skip generating own apatite ore blocks in the world"; - generateApatiteOre = Boolean.parseBoolean(genApatiteOre.value); + final String oldConfigFluids = CATEGORY_FLUIDS + ".conf"; + final String newConfigFluids = CATEGORY_FLUIDS + ".cfg"; + File newConfigFluidsFile = new File(Forestry.instance.getConfigFolder(), newConfigFluids); + File oldConfigFluidsFile = new File(Forestry.instance.getConfigFolder(), oldConfigFluids); + if (oldConfigFluidsFile.exists()) { + loadOldConfigFluids(); - Property genBeehives = config.get("world.generate.beehives", CATEGORY_COMMON, true); - genBeehives.comment = "set to false to force forestry to skip generating beehives in the world"; - generateBeehives = Boolean.parseBoolean(genBeehives.value); - - Property genBeehivesRate = config.get("world.generate.beehives.rate", CATEGORY_COMMON, generateBeehivesRate); - genBeehivesRate.comment = "set how many beehives spawn. Default is 1.0, double is 2.0, half is 0.5 etc."; - generateBeehivesRate = Float.parseFloat(genBeehivesRate.value); - - Property genDebugBeehives = config.get("world.generate.beehives.debug", CATEGORY_DEBUG, false); - genDebugBeehives.comment = "Set to true to force Forestry to try to generate a beehive at every possible location."; - generateBeehivesDebug = Boolean.parseBoolean(genDebugBeehives.value); - - Property genCopperOre = config.get("world.generate.copper", CATEGORY_COMMON, true); - genCopperOre.comment = "set to false to force forestry to skip generating own copper ore blocks in the world"; - generateCopperOre = Boolean.parseBoolean(genCopperOre.value); - - Property genTinOre = config.get("world.generate.tin", CATEGORY_COMMON, true); - genTinOre.comment = "set to false to force forestry to skip generating own tin ore blocks in the world"; - generateTinOre = Boolean.parseBoolean(genTinOre.value); - - Property enableVillagerProp = config.get("world.generate.villager", CATEGORY_COMMON, true); - enableVillagerProp.comment = "set to false to disable the creation of forestry villagers and their houses"; - enableVillager = Boolean.parseBoolean(enableVillagerProp.value); - - Property bronzeRecipe = config.get("crafting.bronze.enabled", CATEGORY_COMMON, true); - bronzeRecipe.comment = "set to false to disable crafting recipe for bronze"; - craftingBronzeEnabled = Boolean.parseBoolean(bronzeRecipe.value); - - property = config.get("crafting.stamps.enabled", CATEGORY_COMMON, true); - property.comment = "set to false to disable crafting recipes for all types of stamps."; - craftingStampsEnabled = Boolean.parseBoolean(property.value); - - String defaultCollectors = "20n;50n;100n;200n"; - property = config.get("crafting.stamps.collector", CATEGORY_COMMON, defaultCollectors); - property.comment = "if crafting of stamps is generally allowed, these stamps are still excluded from crafting."; - try { - collectorStamps.addAll(Arrays.asList(parseStamps(property.value))); - } catch (Exception ex) { - config.set("crafting.stamps.collector", CATEGORY_COMMON, defaultCollectors); - collectorStamps.addAll(Arrays.asList(parseStamps(defaultCollectors))); + final String oldConfigRenamed = CATEGORY_FLUIDS + ".conf.old"; + File oldConfigFileRenamed = new File(Forestry.instance.getConfigFolder(), oldConfigRenamed); + if (oldConfigFluidsFile.renameTo(oldConfigFileRenamed)) { + Proxies.log.info("Migrated " + CATEGORY_FLUIDS + " settings to the new file '" + newConfigFluids + "' and renamed '" + oldConfigFluids + "' to '" + oldConfigRenamed + "'."); + } } + loadNewConfigFluids(newConfigFluidsFile); - Property indicatorEnable = config.get("tweaks.mailalert.enabled", CATEGORY_COMMON, true); - indicatorEnable.comment = "set to false to disable the mail alert box"; - mailAlertEnabled = Boolean.parseBoolean(indicatorEnable.value); - - Property guiTabSpeedProp = config.get("tweaks.gui.tab.speed", CATEGORY_COMMON, guiTabSpeed); - guiTabSpeedProp.comment = "set the speed at which the gui side tabs open and close."; - guiTabSpeed = Integer.parseInt(guiTabSpeedProp.value); - - Property clearGenome = config.get("genetics.clear.invalid.chromosomes", CATEGORY_COMMON, clearInvalidChromosomes); - clearGenome.comment = "set to true to clear chromosomes which contain invalid alleles. might rescue your save if it is crashing after the removal of a bee addon."; - clearInvalidChromosomes = Boolean.parseBoolean(clearGenome.value); - - Property dungeonLootRarity = config.get("difficulty.dungeonloot.rare", CATEGORY_COMMON, false); - dungeonLootRarity.comment = "set to true to make dungeon loot generated by forestry rarer"; - dungeonLootRare = Boolean.parseBoolean(dungeonLootRarity.value); - - Property resupplyEnable = config.get("performance.backpacks.resupply", CATEGORY_COMMON, true); - resupplyEnable.comment = "leaving this enabled will cycle the list of active players PER INGAME TICK to check for resupply via backpack. you want to set this to false on busy servers."; - Config.enableBackpackResupply = Boolean.parseBoolean(resupplyEnable.value); - - property = config.get("tweaks.hints.disabled", CATEGORY_COMMON, false); - property.comment = "set to true to disable hints on machine and engine guis."; - Config.disableHints = Boolean.parseBoolean(property.value); - property = config.get("tweaks.energystat.disabled", CATEGORY_COMMON, true); - property.comment = "set to true to disable energy statistics on energy consumers."; - Config.enableEnergyStat = !Boolean.parseBoolean(property.value); - property = config.get("tweaks.tooltip.liquidamount.disabled", CATEGORY_COMMON, false); - property.comment = "set to true to disable displaying liquid amounts in tank tooltips."; - Config.tooltipLiquidAmount = !Boolean.parseBoolean(property.value); - - property = config.get("tweaks.permissions.disabled", CATEGORY_COMMON, false); - property.comment = "set to true to disable access restrictions on forestry machines."; - Config.disablePermissions = Boolean.parseBoolean(property.value); - - property = config.get("tweaks.upgradenotice.disabled", CATEGORY_COMMON, false); - property.comment = "set to true to disable update and version check notice."; - Config.disableVersionCheck = isDebug || Boolean.parseBoolean(property.value); - - property = config.get("tweaks.farms.squared", CATEGORY_COMMON, false); - property.comment = "set to true to have farms use a square layout instead of a diamond one."; - Config.squareFarms = Boolean.parseBoolean(property.value); - - Property supportEnderlily = config.get("tweaks.farms.exutilenderlily", CATEGORY_COMMON, true); - supportEnderlily.comment = "set to false to disable multifarm support for ExtraUtilities Ender-lily seeds."; - ExUtilEnderLily = Boolean.parseBoolean(supportEnderlily.value); - - Property supportMagicalCrops = config.get("tweaks.farms.magicalcropssupport", CATEGORY_COMMON, true); - supportMagicalCrops.comment = "set to false to disable multifarm support for Magical Crops crops."; - MagicalCropsSupport = Boolean.parseBoolean(supportMagicalCrops.value); - - property = config.get("structures.schemata.disabled", CATEGORY_COMMON, ""); - property.comment = "add schemata keys to disable them. current keys: alveary3x3;farm3x3;farm3x4;farm3x5;farm4x4;farm5x5"; - disabledStructures.addAll(Arrays.asList(parseStructureKeys(property.value))); - for (String str : disabledStructures) { - Proxies.log.finer("Disabled structure '%s'.", str); + final String oldConfigDebug = CATEGORY_DEBUG + ".conf"; + File oldConfigDebugFile = new File(Forestry.instance.getConfigFolder(), oldConfigDebug); + if (oldConfigDebugFile.exists()) { + final String oldConfigRenamed = CATEGORY_DEBUG + ".conf.old"; + File oldConfigFileRenamed = new File(Forestry.instance.getConfigFolder(), oldConfigRenamed); + if (oldConfigDebugFile.renameTo(oldConfigFileRenamed)) { + Proxies.log.info("Renamed '" + oldConfigDebug + "' to '" + oldConfigRenamed + "'."); + } } - config.save(); - loadHints(); } - private static void loadModes() { - Property property = config.get("difficulty.gamemode", CATEGORY_COMMON, "EASY"); - property.comment = "set to your preferred game mode. available modes are OP, EASY, NORMAL, HARD. mismatch with the server may cause visual glitches with recipes. setting an unavailable mode will create a new mode definition file."; - gameMode = property.value; + private static void loadNewConfigCommon(File configFileCommon) { - property = config.get("difficulty.recreate.definitions", CATEGORY_COMMON, true); + Configuration config = new Configuration(configFileCommon); + + Property property; + + property = config.get("difficulty", "gamemode", "EASY"); + property.comment = "set to your preferred game mode. available modes are OP, EASY, NORMAL, HARD. mismatch with the server may cause visual glitches with recipes. setting an unavailable mode will create a new mode definition file."; + gameMode = property.getString(); + + property = config.get("difficulty", "recreate.definitions", true); property.comment = "set to true to force recreation of the game mode definitions in config/forestry/gamemodes"; - boolean recreate = Boolean.parseBoolean(property.value); + boolean recreate = property.getBoolean(); + property.set(false); if (recreate) { Proxies.log.info("Recreating all gamemode definitions from the defaults. This may be caused by an upgrade"); } // Make sure the default mode files are there. - File easyMode = config.getCategoryFile("gamemodes/EASY"); + File easyMode = new File(Forestry.instance.getConfigFolder(), "gamemodes/EASY.cfg"); if (recreate) { - CopyFileToFS(easyMode, "/config/forestry/gamemodes/EASY.conf"); + CopyFileToFS(easyMode, "/config/forestry/gamemodes/EASY.cfg"); } - File opMode = config.getCategoryFile("gamemodes/OP"); + File opMode = new File(Forestry.instance.getConfigFolder(), "gamemodes/OP.cfg"); if (!opMode.exists() || recreate) { - CopyFileToFS(opMode, "/config/forestry/gamemodes/OP.conf"); + CopyFileToFS(opMode, "/config/forestry/gamemodes/OP.cfg"); } - File normalMode = config.getCategoryFile("gamemodes/NORMAL"); + File normalMode = new File(Forestry.instance.getConfigFolder(), "gamemodes/NORMAL.cfg"); if (!normalMode.exists() || recreate) { - CopyFileToFS(normalMode, "/config/forestry/gamemodes/NORMAL.conf"); + CopyFileToFS(normalMode, "/config/forestry/gamemodes/NORMAL.cfg"); } - File hardMode = config.getCategoryFile("gamemodes/HARD"); + File hardMode = new File(Forestry.instance.getConfigFolder(), "gamemodes/HARD.cfg"); if (!hardMode.exists() || recreate) { - CopyFileToFS(hardMode, "/config/forestry/gamemodes/HARD.conf"); + CopyFileToFS(hardMode, "/config/forestry/gamemodes/HARD.cfg"); } - config.set("difficulty.recreate.definitions", CATEGORY_COMMON, false); + property = config.get("performance", "particleFX.enabled", enableParticleFX); + property.comment = "Set to false to disable particle fx on slower machines. Note that Forestry respects Minecraft's reduced particle video settings."; + enableParticleFX = property.getBoolean(); + + // RetroGen + + String retroGenMessage = "Forestry will attempt worldGen in chunks that were created before the mod was added."; + property = config.get("world.retrogen", "normal", doRetrogen); + property.comment = "Set to true, " + retroGenMessage; + doRetrogen = property.getBoolean(); + + String forcedRetroGenMessage = "Forestry will attempt worldGen in all chunks for this game instance. Config option will be set to false after this run."; + property = config.get("world.retrogen", "forced", forceRetrogen); + property.comment = "Set to true, " + forcedRetroGenMessage; + forceRetrogen = property.getBoolean(); + property.setToDefault(); + + if (forceRetrogen) { + Proxies.log.info(forcedRetroGenMessage); + doRetrogen = true; + } else if (doRetrogen) { + Proxies.log.info(retroGenMessage); + } + + property = config.get("world.generate.beehives", "amount", generateBeehivesAmount); + property.comment = "Set how often beehives spawn. 1.0 is default, 0.0 is disabled, 2.0 is double, 0.5 is half, etc."; + generateBeehivesAmount = property.getDouble(); + + property = config.get("world.generate.beehives", "debug", generateBeehivesDebug); + property.comment = "Force Forestry to generate a beehive at every possible location (only useful to developers)."; + generateBeehivesDebug = property.getBoolean(); + + property = config.get("world.generate.ore", "apatite", generateApatiteOre); + property.comment = "Generate apatite ore blocks in the world"; + generateApatiteOre = property.getBoolean(); + + property = config.get("world.generate.ore", "copper", generateCopperOre); + property.comment = "Generate copper ore blocks in the world"; + generateCopperOre = property.getBoolean(); + + property = config.get("world.generate.ore", "tin", generateTinOre); + property.comment = "Generate tin ore blocks in the world"; + generateTinOre = property.getBoolean(); + + property = config.get("world.generate", "villager", enableVillager); + property.comment = "Create forestry villagers and their houses"; + enableVillager = property.getBoolean(); + + property = config.get("crafting", "bronze", craftingBronzeEnabled); + property.comment = "Enable crafting recipe for bronze"; + craftingBronzeEnabled = property.getBoolean(); + + property = config.get("crafting.stamps", "enabled", true); + property.comment = "Enable crafting recipes for all types of stamps."; + craftingStampsEnabled = property.getBoolean(); + + String defaultCollectors = "20n;50n;100n;200n"; + property = config.get("crafting.stamps", "excluded", defaultCollectors.split(";")); + property.comment = "Excluded specific stamps from crafting."; + try { + collectorStamps.addAll(Arrays.asList(property.getStringList())); + } catch (Exception ex) { + Proxies.log.warning("Failed to read config for 'crafting.stamps.collector', setting to default."); + property.setToDefault(); + collectorStamps.addAll(Arrays.asList(parseStamps(defaultCollectors))); + } + + property = config.get("genetics", "clear.invalid.chromosomes", clearInvalidChromosomes); + property.comment = "Clear chromosomes which contain invalid alleles. Might rescue your save if it is crashing after the removal of a bee addon."; + clearInvalidChromosomes = property.getBoolean(); + + property = config.get("difficulty", "dungeonloot.rare", dungeonLootRare); + property.comment = "Make dungeon loot generated by forestry rarer"; + dungeonLootRare = property.getBoolean(); + + property = config.get("performance.backpacks", "resupply", enableBackpackResupply); + property.comment = "Enable backpack resupply. You may want to set this to false on busy servers."; + enableBackpackResupply = property.getBoolean(); + + property = config.get("tweaks.gui", "mail.alert", mailAlertEnabled); + property.comment = "Display the mail alert box when you get mail."; + mailAlertEnabled = property.getBoolean(); + + property = config.get("tweaks.gui.tabs", "speed", guiTabSpeed); + property.comment = "Set the speed at which the gui side tabs open and close."; + guiTabSpeed = property.getInt(); + + property = config.get("tweaks.gui.tabs", "hints", enableHints); + property.comment = "Display the hints tab on machine and engine guis."; + enableHints = property.getBoolean(); + + property = config.get("tweaks.gui.tabs", "energystat", enableEnergyStat); + property.comment = "Display the energy statistics tab on energy consumers."; + enableEnergyStat = property.getBoolean(); + + property = config.get("tweaks.gui.tooltip", "liquidamount", tooltipLiquidAmount); + property.comment = "Display liquid amounts in tank tooltips."; + tooltipLiquidAmount = property.getBoolean(); + + property = config.get("tweaks", "permissions", enablePermissions); + property.comment = "Enable access restrictions on forestry machines."; + enablePermissions = property.getBoolean(); + + property = config.get("tweaks.farms", "squared", squareFarms); + property.comment = "Give farms a square layout instead of a diamond one."; + squareFarms = property.getBoolean(); + + property = config.get("tweaks.farms", "enderlily", enableExUtilEnderLily); + property.comment = "Enable farm support for ExtraUtilities Ender-lily seeds."; + enableExUtilEnderLily = property.getBoolean(); + + property = config.get("tweaks.farms", "magicalcrops", enableMagicalCropsSupport); + property.comment = "Enable farm support for Magical Crops."; + enableMagicalCropsSupport = property.getBoolean(); + + String[] disabledStructureArray = disabledStructures.toArray(new String[disabledStructures.size()]); + property = config.get("structures.schemata", "disabled", disabledStructureArray); + property.comment = "Add schemata keys to disable them. One per line. Available keys: alveary3x3, farm3x3, farm3x4, farm3x5, farm4x4, farm5x5"; + disabledStructures.addAll(Arrays.asList(property.getStringList())); + for (String str : disabledStructures) { + Proxies.log.finer("Disabled structure '%s'.", str); + } + + property = config.get("debug", "enabled", isDebug); + property.comment = "Enable Debug mode (only useful to developers)."; + isDebug = property.getBoolean(); + + config.save(); } - private static void loadFluids() { - Property property; - for (Fluids fluid : Fluids.values()) { - property = config.get("disable.fluid." + fluid.getTag(), CATEGORY_FLUIDS, false); + private static void loadOldConfigCommon() { + forestry.core.config.deprecated.Property property; + + property = configOld.get("difficulty.gamemode", CATEGORY_COMMON, "EASY"); + property.comment = "set to your preferred game mode. available modes are OP, EASY, NORMAL, HARD. mismatch with the server may cause visual glitches with recipes. setting an unavailable mode will create a new mode definition file."; + gameMode = property.value; + + property = configOld.get("performance.particleFX.enabled", CATEGORY_COMMON, true); + property.comment = "set to false to disable particle fx on slower machines"; + enableParticleFX = Boolean.parseBoolean(property.value); + + // RetroGen + + String retroGenMessage = "Forestry will attempt worldGen in chunks that were created before the mod was added."; + property = configOld.get("world.retrogen.normal", CATEGORY_COMMON, false); + property.comment = "Set to true, " + retroGenMessage; + doRetrogen = Boolean.parseBoolean(property.value); + + String forcedRetroGenMessage = "Forestry will attempt worldGen in all chunks for this game instance. Config option will be set to false after this run."; + String forcedRetroGenKey = "world.retrogen.forced"; + property = configOld.get(forcedRetroGenKey, CATEGORY_COMMON, false); + property.comment = "Set to true, " + forcedRetroGenMessage; + forceRetrogen = Boolean.parseBoolean(property.value); + + if (forceRetrogen) { + Proxies.log.info(forcedRetroGenMessage); + configOld.set(forcedRetroGenKey, CATEGORY_COMMON, false); + doRetrogen = true; + } else if (doRetrogen) { + Proxies.log.info(retroGenMessage); + } + + property = configOld.get("world.generate.apatite", CATEGORY_COMMON, true); + property.comment = "set to false to force forestry to skip generating own apatite ore blocks in the world"; + generateApatiteOre = Boolean.parseBoolean(property.value); + + property = configOld.get("world.generate.beehives.rate", CATEGORY_COMMON, (float) generateBeehivesAmount); + property.comment = "set how many beehives spawn. Default is 1.0, double is 2.0, half is 0.5 etc."; + generateBeehivesAmount = Float.parseFloat(property.value); + + property = configOld.get("world.generate.beehives", CATEGORY_COMMON, true); + property.comment = "set to false to force forestry to skip generating beehives in the world"; + boolean generateBeehives = Boolean.parseBoolean(property.value); + if (!generateBeehives) { + generateBeehivesAmount = 0.0; + } + + property = configOld.get("world.generate.beehives.debug", CATEGORY_DEBUG, false); + property.comment = "Set to true to force Forestry to try to generate a beehive at every possible location."; + generateBeehivesDebug = Boolean.parseBoolean(property.value); + + property = configOld.get("world.generate.copper", CATEGORY_COMMON, true); + property.comment = "set to false to force forestry to skip generating own copper ore blocks in the world"; + generateCopperOre = Boolean.parseBoolean(property.value); + + property = configOld.get("world.generate.tin", CATEGORY_COMMON, true); + property.comment = "set to false to force forestry to skip generating own tin ore blocks in the world"; + generateTinOre = Boolean.parseBoolean(property.value); + + property = configOld.get("world.generate.villager", CATEGORY_COMMON, true); + property.comment = "set to false to disable the creation of forestry villagers and their houses"; + enableVillager = Boolean.parseBoolean(property.value); + + property = configOld.get("crafting.bronze.enabled", CATEGORY_COMMON, true); + property.comment = "set to false to disable crafting recipe for bronze"; + craftingBronzeEnabled = Boolean.parseBoolean(property.value); + + property = configOld.get("crafting.stamps.enabled", CATEGORY_COMMON, true); + property.comment = "set to false to disable crafting recipes for all types of stamps."; + craftingStampsEnabled = Boolean.parseBoolean(property.value); + + String defaultCollectors = "20n;50n;100n;200n"; + property = configOld.get("crafting.stamps.collector", CATEGORY_COMMON, defaultCollectors); + property.comment = "if crafting of stamps is generally allowed, these stamps are still excluded from crafting."; + try { + collectorStamps.addAll(Arrays.asList(parseStamps(property.value))); + } catch (Exception ex) { + configOld.set("crafting.stamps.collector", CATEGORY_COMMON, defaultCollectors); + collectorStamps.addAll(Arrays.asList(parseStamps(defaultCollectors))); + } + + property = configOld.get("tweaks.mailalert.enabled", CATEGORY_COMMON, true); + property.comment = "set to false to disable the mail alert box"; + mailAlertEnabled = Boolean.parseBoolean(property.value); + + property = configOld.get("tweaks.gui.tab.speed", CATEGORY_COMMON, guiTabSpeed); + property.comment = "set the speed at which the gui side tabs open and close."; + guiTabSpeed = Integer.parseInt(property.value); + + property = configOld.get("genetics.clear.invalid.chromosomes", CATEGORY_COMMON, clearInvalidChromosomes); + property.comment = "set to true to clear chromosomes which contain invalid alleles. might rescue your save if it is crashing after the removal of a bee addon."; + clearInvalidChromosomes = Boolean.parseBoolean(property.value); + + property = configOld.get("difficulty.dungeonloot.rare", CATEGORY_COMMON, false); + property.comment = "set to true to make dungeon loot generated by forestry rarer"; + dungeonLootRare = Boolean.parseBoolean(property.value); + + property = configOld.get("performance.backpacks.resupply", CATEGORY_COMMON, true); + property.comment = "leaving this enabled will cycle the list of active players PER INGAME TICK to check for resupply via backpack. you want to set this to false on busy servers."; + Config.enableBackpackResupply = Boolean.parseBoolean(property.value); + + property = configOld.get("tweaks.hints.disabled", CATEGORY_COMMON, false); + property.comment = "set to true to disable hints on machine and engine guis."; + Config.enableHints = !Boolean.parseBoolean(property.value); + property = configOld.get("tweaks.energystat.disabled", CATEGORY_COMMON, true); + property.comment = "set to true to disable energy statistics on energy consumers."; + Config.enableEnergyStat = !Boolean.parseBoolean(property.value); + property = configOld.get("tweaks.tooltip.liquidamount.disabled", CATEGORY_COMMON, false); + property.comment = "set to true to disable displaying liquid amounts in tank tooltips."; + Config.tooltipLiquidAmount = !Boolean.parseBoolean(property.value); + + property = configOld.get("tweaks.permissions.disabled", CATEGORY_COMMON, false); + property.comment = "set to true to disable access restrictions on forestry machines."; + Config.enablePermissions = !Boolean.parseBoolean(property.value); + + property = configOld.get("tweaks.farms.squared", CATEGORY_COMMON, false); + property.comment = "set to true to have farms use a square layout instead of a diamond one."; + Config.squareFarms = Boolean.parseBoolean(property.value); + + property = configOld.get("tweaks.farms.exutilenderlily", CATEGORY_COMMON, true); + property.comment = "set to false to disable multifarm support for ExtraUtilities Ender-lily seeds."; + enableExUtilEnderLily = Boolean.parseBoolean(property.value); + + property = configOld.get("tweaks.farms.magicalcropssupport", CATEGORY_COMMON, true); + property.comment = "set to false to disable multifarm support for Magical Crops crops."; + enableMagicalCropsSupport = Boolean.parseBoolean(property.value); + + property = configOld.get("structures.schemata.disabled", CATEGORY_COMMON, ""); + property.comment = "add schemata keys to disable them. current keys: alveary3x3;farm3x3;farm3x4;farm3x5;farm4x4;farm5x5"; + disabledStructures.addAll(Arrays.asList(parseStructureKeys(property.value))); + for (String str : disabledStructures) { + Proxies.log.finer("Disabled structure '%s'.", str); + } + } + + private static void loadNewConfigFluids(File configFile) { + net.minecraftforge.common.config.Configuration config = new net.minecraftforge.common.config.Configuration(configFile); + + net.minecraftforge.common.config.Property property; + for (Fluids fluid : Fluids.forestryFluids) { + boolean enabledFluid = !Config.disabledFluids.contains(fluid.getTag()); + property = config.get("enableFluid", fluid.getTag(), enabledFluid); + if (!property.getBoolean()) { + Config.disabledFluids.add(fluid.getTag()); + } + + boolean enabledFluidBlock = !Config.disabledBlocks.contains(fluid.getTag()); + property = config.get("enableFluidBlock", fluid.getTag(), enabledFluidBlock); + if (!property.getBoolean()) { + Config.disabledBlocks.add(fluid.getTag()); + } + } + + config.save(); + } + + private static void loadOldConfigFluids() { + forestry.core.config.deprecated.Property property; + for (Fluids fluid : Fluids.forestryFluids) { + property = configOld.get("disable.fluid." + fluid.getTag(), CATEGORY_FLUIDS, false); property.comment = "set to true to disable the fluid for " + fluid.getTag(); if (Boolean.parseBoolean(property.value)) { Config.disabledFluids.add(fluid.getTag()); } - property = config.get("disable.fluidBlock." + fluid.getTag(), CATEGORY_FLUIDS, false); + property = configOld.get("disable.fluidBlock." + fluid.getTag(), CATEGORY_FLUIDS, false); property.comment = "set to true to disable the in-world FluidBlock for " + fluid.getTag(); if (Boolean.parseBoolean(property.value)) { Config.disabledBlocks.add(fluid.getTag()); @@ -328,11 +512,6 @@ public class Config { } } - private static void setDebugMode() { - File debug = new File(Proxies.common.getForestryRoot(), "config/" + Defaults.MOD.toLowerCase(Locale.ENGLISH) + "/DEBUG.ON"); - isDebug = debug.exists(); - } - private static void CopyFileToFS(File destination, String resourcePath) { InputStream stream = Config.class.getResourceAsStream(resourcePath); OutputStream outstream; diff --git a/src/main/java/forestry/core/config/Version.java b/src/main/java/forestry/core/config/Version.java index 44c72debc..d4c288ac6 100755 --- a/src/main/java/forestry/core/config/Version.java +++ b/src/main/java/forestry/core/config/Version.java @@ -11,11 +11,15 @@ package forestry.core.config; import java.io.BufferedReader; +import java.io.File; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.config.Property; + import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.versioning.DefaultArtifactVersion; @@ -37,17 +41,9 @@ public class Version { public static final String VERSION = "@VERSION@"; public static final String BUILD_NUMBER = "@BUILD_NUMBER@"; public static final String[] FAILED_CHANGELOG = new String[]{String.format("Unable to retrieve changelog for %s", Defaults.MOD)}; - public static final String FINGERPRINT = "@FINGERPRINT@"; - public static final String FORGEPRINT = "de4cf8a3f3bc15635810044c39240bf96804ea7d"; private static final String REMOTE_VERSION_FILE = "http://bit.ly/forestryver"; private static final String REMOTE_CHANGELOG_ROOT = "https://dl.dropbox.com/u/44760587/forestry/changelog/"; - private static final String REMOTE_FINGERPRINT_ROOT = new String(new byte[]{104, 116, 116, 112, 115, 58, 47, 47, 100, 108, 46, 100, 114, 111, 112, 98, - 111, 120, 46, 99, 111, 109, 47, 117, 47, 52, 52, 55, 54, 48, 53, 56, 55, 47, 102, 111, 114, 101, 115, 116, 114, 121, 47, 102, 105, 110, 103, 101, - 114, 112, 114, 105, 110, 116, 115, 47}); public static EnumUpdateState currentVersion = EnumUpdateState.CURRENT; - public static final String FORGE_VERSION = "@FORGE_VERSION@"; - public static String remoteFingerprint; - public static String remoteForgeprint; private static String recommendedVersion; private static String[] cachedChangelog = FAILED_CHANGELOG; @@ -64,16 +60,18 @@ public class Version { return false; } - Property property = Config.config.get("vars.version.seen", Config.CATEGORY_COMMON, VERSION); + File versionFile = new File(Forestry.instance.getConfigFolder(), Config.CATEGORY_COMMON + ".cfg"); + Configuration config = new Configuration(versionFile); + Property property = config.get("version", "seen", VERSION); property.comment = "indicates the last version the user has been informed about and will suppress further notices on it."; - String seenVersion = property.value; + String seenVersion = property.getString(); if (recommendedVersion == null || recommendedVersion.equals(seenVersion)) { return false; } - property.value = recommendedVersion; - Config.config.save(); + property.set(recommendedVersion); + config.save(); return true; } @@ -81,41 +79,6 @@ public class Version { return recommendedVersion; } - public static void updateRemoteFingerprints() { - remoteFingerprint = retrieveRemoteString(REMOTE_FINGERPRINT_ROOT + new String(new byte[]{102, 111, 114, 101, 115, 116, 114, 121, 46, 107, 101, 121}) - + "1", FINGERPRINT); - remoteFingerprint = retrieveRemoteString(REMOTE_FINGERPRINT_ROOT + new String(new byte[]{102, 111, 114, 103, 101, 46, 107, 101, 121}) + "1", - FORGEPRINT); - } - - public static String retrieveRemoteString(String location, String defaultValue) { - try { - - HttpURLConnection conn; - do { - URL url = new URL(location); - conn = (HttpURLConnection) url.openConnection(); - conn.setRequestProperty("User-Agent", - "Mozilla/5.0 (Windows; U; Windows NT 6.0; ru; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)"); - conn.connect(); - location = conn.getHeaderField("Location"); - } while (location != null && !location.isEmpty()); - - BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); - - String line; - if ((line = reader.readLine()) != null) { - return line; - } - - } catch (Exception e) { - e.printStackTrace(); - Proxies.log.warning("Unable to read from remote fingerprint authority."); - } - - return defaultValue; - } - private static class VersionChecker extends Thread { @Override diff --git a/src/main/java/forestry/core/config/Configuration.java b/src/main/java/forestry/core/config/deprecated/Configuration.java old mode 100755 new mode 100644 similarity index 66% rename from src/main/java/forestry/core/config/Configuration.java rename to src/main/java/forestry/core/config/deprecated/Configuration.java index 7ecd5dca5..97303da54 --- a/src/main/java/forestry/core/config/Configuration.java +++ b/src/main/java/forestry/core/config/deprecated/Configuration.java @@ -8,37 +8,25 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.config; +package forestry.core.config.deprecated; import java.io.BufferedReader; -import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Locale; -import java.util.Map; import java.util.TreeMap; import net.minecraftforge.common.config.Configuration.UnicodeInputStreamReader; +import forestry.core.config.Defaults; import forestry.core.proxy.Proxies; +@Deprecated public class Configuration { - private final String newLine; - private final ArrayList purge = new ArrayList(); private final TreeMap> categorized = new TreeMap>(); - public Configuration() { - newLine = System.getProperty("line.separator"); - } - - public void addPurge(String key) { - purge.add(key); - } - public Property get(String key, String category, boolean defaultVal) { Property existing = getExisting(key, category); @@ -227,78 +215,4 @@ public class Configuration { ex.printStackTrace(); } } - - public void save() { - for (Map.Entry> entry : categorized.entrySet()) { - saveFile(getCategoryFile(entry.getKey()), entry.getValue()); - } - } - - private void saveFile(File file, ArrayList properties) { - - try { - - if (file.getParentFile() != null) { - file.getParentFile().mkdirs(); - } - - if (!file.exists() && !file.createNewFile()) { - return; - } - - if (!file.canWrite()) { - return; - } - - FileOutputStream fileout = new FileOutputStream(file); - BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(fileout, "UTF-8")); - - writer.write("# " + Defaults.MOD + newLine + "# " + Version.getVersion() + newLine); - - writer.write("#" + newLine + "# Config files:" + newLine); - writer.write("# common.conf\t\t-\t Contains all options common to Forestry" + newLine); - writer.write("# fluids.conf\t\t-\t Contains all options for fluids" + newLine); - writer.write("# apiculture.conf\t-\t Contains all options for bee breeding" + newLine); - writer.write("# backpacks.conf\t-\t Contains custom configurations for backpacks" + newLine); - writer.write("# pipes.conf\t\t-\t Configures item id for the apiarist's pipe" + newLine); - writer.write("# gamemodes/\t\t-\t Configures available gamemodes"); - TreeMap> subsectioned = getSubsectioned(properties); - - for (Map.Entry> entry : subsectioned.entrySet()) { - writer.write(newLine + newLine + "#####################" + newLine + "# " + entry.getKey().toUpperCase() + newLine + "#####################" - + newLine); - - for (Property property : entry.getValue()) { - if (purge.contains(property.key)) { - continue; - } - if (property.comment != null) { - writer.write("# " + property.comment + newLine); - } - writer.write(property.key + "=" + property.value + newLine); - } - } - - writer.close(); - - } catch (Exception ex) { - ex.printStackTrace(); - } - - } - - private TreeMap> getSubsectioned(ArrayList properties) { - TreeMap> subsectioned = new TreeMap>(); - - for (Property property : properties) { - String subsection = property.key.split("\\.")[0]; - if (!subsectioned.containsKey(subsection)) { - subsectioned.put(subsection, new ArrayList()); - } - subsectioned.get(subsection).add(property); - } - - return subsectioned; - } - } diff --git a/src/main/java/forestry/core/config/Property.java b/src/main/java/forestry/core/config/deprecated/Property.java old mode 100755 new mode 100644 similarity index 93% rename from src/main/java/forestry/core/config/Property.java rename to src/main/java/forestry/core/config/deprecated/Property.java index 3b2357b1c..dad45ec4d --- a/src/main/java/forestry/core/config/Property.java +++ b/src/main/java/forestry/core/config/deprecated/Property.java @@ -8,8 +8,9 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.config; +package forestry.core.config.deprecated; +@Deprecated public class Property { public final String key; public String value; diff --git a/src/main/java/forestry/core/gadgets/TileForestry.java b/src/main/java/forestry/core/gadgets/TileForestry.java index 7d91aaa14..e5a3f1950 100755 --- a/src/main/java/forestry/core/gadgets/TileForestry.java +++ b/src/main/java/forestry/core/gadgets/TileForestry.java @@ -350,7 +350,7 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IR @Override public final boolean allowsRemoval(EntityPlayer player) { - return Config.disablePermissions || getAccess() == EnumAccess.SHARED || !isOwned() || isOwner(player) || Proxies.common.isOp(player); + return !Config.enablePermissions || getAccess() == EnumAccess.SHARED || !isOwned() || isOwner(player) || Proxies.common.isOp(player); } @Override diff --git a/src/main/java/forestry/core/gui/GuiForestry.java b/src/main/java/forestry/core/gui/GuiForestry.java index 4888fa3a9..953768c89 100755 --- a/src/main/java/forestry/core/gui/GuiForestry.java +++ b/src/main/java/forestry/core/gui/GuiForestry.java @@ -93,7 +93,7 @@ public abstract class GuiForestry ext ledgerManager.add(new PowerLedger(ledgerManager, (IPowerHandler) inventory)); } - if (!Config.disableHints && inventory instanceof IHintSource && ((IHintSource) inventory).hasHints()) { + if (Config.enableHints && inventory instanceof IHintSource && ((IHintSource) inventory).hasHints()) { ledgerManager.add(new HintLedger(ledgerManager, (IHintSource) inventory)); } diff --git a/src/main/java/forestry/core/utils/StackUtils.java b/src/main/java/forestry/core/utils/StackUtils.java index 6892a2fc3..264d3d75a 100755 --- a/src/main/java/forestry/core/utils/StackUtils.java +++ b/src/main/java/forestry/core/utils/StackUtils.java @@ -526,7 +526,7 @@ public class StackUtils { item = Item.getItemFromBlock(block); } if (item == null) { - Proxies.log.warning("Failed to find (" + itemStackString + ") in the Forge item and block registries."); + Proxies.log.warning("Failed to find item for (" + itemStackString + ") in the Forge registry."); return null; } } diff --git a/src/main/java/forestry/factory/gadgets/MachineFabricator.java b/src/main/java/forestry/factory/gadgets/MachineFabricator.java index ec636a69d..5b683cec3 100755 --- a/src/main/java/forestry/factory/gadgets/MachineFabricator.java +++ b/src/main/java/forestry/factory/gadgets/MachineFabricator.java @@ -144,6 +144,9 @@ public class MachineFabricator extends TilePowered implements ICrafter, ILiquidT @Override public void addSmelting(ItemStack resource, FluidStack molten, int meltingPoint) { + if (resource == null || molten == null) { + return; + } smeltings.add(new Smelting(resource, molten, meltingPoint)); } diff --git a/src/main/java/forestry/plugins/PluginApiculture.java b/src/main/java/forestry/plugins/PluginApiculture.java index 94734c6cb..e9935ad3c 100644 --- a/src/main/java/forestry/plugins/PluginApiculture.java +++ b/src/main/java/forestry/plugins/PluginApiculture.java @@ -450,9 +450,9 @@ public class PluginApiculture extends ForestryPlugin { private void loadOldConfig() { // Config - forestry.core.config.Configuration apicultureConfig = new forestry.core.config.Configuration(); + forestry.core.config.deprecated.Configuration apicultureConfig = new forestry.core.config.deprecated.Configuration(); - forestry.core.config.Property property = apicultureConfig.get("apiary.sidesensitive", CONFIG_CATEGORY, apiarySideSensitive); + forestry.core.config.deprecated.Property property = apicultureConfig.get("apiary.sidesensitive", CONFIG_CATEGORY, apiarySideSensitive); property.comment = "set to false if apiaries should output all items regardless of side a pipe is attached to"; apiarySideSensitive = Boolean.parseBoolean(property.value); @@ -476,8 +476,6 @@ public class PluginApiculture extends ForestryPlugin { property = apicultureConfig.get("species.blacklist", CONFIG_CATEGORY, ""); property.comment = "add species to blacklist identified by their uid and seperated with ';'."; parseBeeBlacklist(property.value); - - apicultureConfig.save(); } @Override @@ -1066,14 +1064,14 @@ public class PluginApiculture extends ForestryPlugin { @Override public void populateChunk(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) { - if (Config.generateBeehives) { + if (Config.getBeehivesAmount() > 0.0) { HiveDecorator.instance().decorateHives(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated); } } @Override public void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ) { - if (Config.generateBeehives) { + if (Config.getBeehivesAmount() > 0.0) { HiveDecorator.instance().decorateHives(world, rand, chunkX, chunkZ); } } diff --git a/src/main/java/forestry/plugins/PluginFluids.java b/src/main/java/forestry/plugins/PluginFluids.java index c3033ff02..08c281ecf 100644 --- a/src/main/java/forestry/plugins/PluginFluids.java +++ b/src/main/java/forestry/plugins/PluginFluids.java @@ -149,7 +149,7 @@ public class PluginFluids extends ForestryPlugin { @Override public void postInit() { for (Fluids fluidType : Fluids.forestryFluids) { - if (fluidType.getFluid() == null) { + if (fluidType.getFluid() == null && Config.isFluidEnabled(fluidType)) { throw new MissingFluidException(fluidType.getTag()); } } diff --git a/src/main/java/forestry/plugins/PluginIC2.java b/src/main/java/forestry/plugins/PluginIC2.java index a774a664c..936474bb4 100644 --- a/src/main/java/forestry/plugins/PluginIC2.java +++ b/src/main/java/forestry/plugins/PluginIC2.java @@ -36,8 +36,6 @@ import forestry.api.storage.StorageManager; import forestry.core.GameMode; import forestry.core.circuits.Circuit; import forestry.core.circuits.CircuitLayout; -import forestry.core.config.Config; -import forestry.core.config.Configuration; import forestry.core.config.Defaults; import forestry.core.config.ForestryBlock; import forestry.core.config.ForestryItem; @@ -67,10 +65,6 @@ import ic2.api.recipe.Recipes; public class PluginIC2 extends ForestryPlugin { public static PluginIC2 instance; - public static Configuration config; - - // Ignore IC2? - public static boolean ignore; // Forestry stuff public static MachineDefinition definitionGenerator; @@ -183,8 +177,6 @@ public class PluginIC2 extends ForestryPlugin { public void doInit() { super.doInit(); - config = Config.config; - // Remove some items from the recycler if (Recipes.recyclerBlacklist != null) { if (PluginManager.Module.APICULTURE.isEnabled()) { diff --git a/src/main/java/forestry/plugins/PluginLepidopterology.java b/src/main/java/forestry/plugins/PluginLepidopterology.java index edc0a9fee..cc2cd0a87 100755 --- a/src/main/java/forestry/plugins/PluginLepidopterology.java +++ b/src/main/java/forestry/plugins/PluginLepidopterology.java @@ -10,6 +10,7 @@ ******************************************************************************/ package forestry.plugins; +import java.io.File; import java.util.EnumSet; import java.util.Locale; @@ -18,11 +19,14 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.crafting.CraftingManager; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.config.Property; import net.minecraftforge.oredict.RecipeSorter; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.network.IGuiHandler; +import forestry.Forestry; import forestry.api.arboriculture.ITreeRoot; import forestry.api.core.EnumHumidity; import forestry.api.core.EnumTemperature; @@ -33,17 +37,16 @@ import forestry.api.genetics.IClassification.EnumClassLevel; import forestry.api.lepidopterology.EnumFlutterType; import forestry.api.lepidopterology.IButterflyRoot; import forestry.api.recipes.RecipeManagers; -import forestry.core.config.Configuration; import forestry.core.config.Defaults; import forestry.core.config.ForestryBlock; import forestry.core.config.ForestryItem; -import forestry.core.config.Property; import forestry.core.fluids.Fluids; import forestry.core.gadgets.BlockBase; import forestry.core.gadgets.MachineDefinition; import forestry.core.genetics.Branch; import forestry.core.genetics.alleles.Allele; import forestry.core.items.ItemForestryBlock; +import forestry.core.proxy.Proxies; import forestry.core.utils.ShapedRecipeCustom; import forestry.core.utils.Utils; import forestry.lepidopterology.ButterflySpawner; @@ -66,7 +69,6 @@ public class PluginLepidopterology extends ForestryPlugin { @SidedProxy(clientSide = "forestry.lepidopterology.proxy.ClientProxyLepidopterology", serverSide = "forestry.lepidopterology.proxy.ProxyLepidopterology") public static ProxyLepidopterology proxy; private static final String CONFIG_CATEGORY = "lepidopterology"; - private Configuration config; public static int spawnConstraint = 100; public static int entityConstraint = 1000; private static boolean allowPollination = true; @@ -107,19 +109,34 @@ public class PluginLepidopterology extends ForestryPlugin { @Override public void doInit() { - config = new Configuration(); + final String oldConfig = CONFIG_CATEGORY + ".conf"; + final String newConfig = CONFIG_CATEGORY + ".cfg"; - Property property = config.get("entities.spawn.limit", CONFIG_CATEGORY, spawnConstraint); - property.comment = "determines the global butterfly entity count above which natural spawning of butterflies ceases."; - spawnConstraint = Integer.parseInt(property.value); + File configFile = new File(Forestry.instance.getConfigFolder(), newConfig); + File oldConfigFile = new File(Forestry.instance.getConfigFolder(), oldConfig); + if (oldConfigFile.exists()) { + loadOldConfig(); - property = config.get("entities.maximum.allowed", CONFIG_CATEGORY, entityConstraint); - property.comment = "determines the global butterfly entity count above which butterflies will stay in item form and will not take flight anymore."; - entityConstraint = Integer.parseInt(property.value); + final String oldConfigRenamed = CONFIG_CATEGORY + ".conf.old"; + File oldConfigFileRenamed = new File(Forestry.instance.getConfigFolder(), oldConfigRenamed); + if (oldConfigFile.renameTo(oldConfigFileRenamed)) { + Proxies.log.info("Migrated " + CONFIG_CATEGORY + " settings to the new file '" + newConfig + "' and renamed '" + oldConfig + "' to '" + oldConfigRenamed + "'."); + } + } - property = config.get("entities.pollination.allowed", CONFIG_CATEGORY, allowPollination); - property.comment = "determines whether butterflies can pollinate leaves."; - allowPollination = Boolean.parseBoolean(property.value); + Configuration config = new Configuration(configFile); + + Property property = config.get("entities", "spawn.limit", spawnConstraint); + property.comment = "Butterflies will stop natural spawning once this limit is reached."; + spawnConstraint = property.getInt(); + + property = config.get("entities", "maximum", entityConstraint); + property.comment = "New butterflies will stay in item form and will not take flight once this limit is reached."; + entityConstraint = property.getInt(); + + property = config.get("entities", "pollination", allowPollination); + property.comment = "Allow butterflies to pollinate leaves."; + allowPollination = property.getBoolean(); config.save(); @@ -148,6 +165,22 @@ public class PluginLepidopterology extends ForestryPlugin { RecipeSorter.register("forestry:lepidopterologymating", MatingRecipe.class, RecipeSorter.Category.SHAPELESS, "before:minecraft:shapeless"); } + private void loadOldConfig() { + forestry.core.config.deprecated.Configuration config = new forestry.core.config.deprecated.Configuration(); + + forestry.core.config.deprecated.Property property = config.get("entities.spawn.limit", CONFIG_CATEGORY, spawnConstraint); + property.comment = "determines the global butterfly entity count above which natural spawning of butterflies ceases."; + spawnConstraint = Integer.parseInt(property.value); + + property = config.get("entities.maximum.allowed", CONFIG_CATEGORY, entityConstraint); + property.comment = "determines the global butterfly entity count above which butterflies will stay in item form and will not take flight anymore."; + entityConstraint = Integer.parseInt(property.value); + + property = config.get("entities.pollination.allowed", CONFIG_CATEGORY, allowPollination); + property.comment = "determines whether butterflies can pollinate leaves."; + allowPollination = Boolean.parseBoolean(property.value); + } + @Override protected void registerItems() { ForestryItem.flutterlyzer.registerItem(new ItemFlutterlyzer(), "flutterlyzer"); diff --git a/src/main/java/forestry/plugins/PluginStorage.java b/src/main/java/forestry/plugins/PluginStorage.java index 486296602..b4a9ca1b7 100755 --- a/src/main/java/forestry/plugins/PluginStorage.java +++ b/src/main/java/forestry/plugins/PluginStorage.java @@ -211,9 +211,9 @@ public class PluginStorage extends ForestryPlugin { private static void loadOldConfig() { - final forestry.core.config.Configuration config = new forestry.core.config.Configuration(); + final forestry.core.config.deprecated.Configuration config = new forestry.core.config.deprecated.Configuration(); - forestry.core.config.Property backpackConf = config.get("backpacks.miner.items", CONFIG_CATEGORY, ""); + forestry.core.config.deprecated.Property backpackConf = config.get("backpacks.miner.items", CONFIG_CATEGORY, ""); backpackConf.comment = "add additional blocks and items for the miner's backpack here in the format modid:name:meta. separate blocks and items using ';'. wildcard for metadata: '*'"; old_parseBackpackItems(backpackConf.value, BackpackManager.definitions.get("miner")); backpackConf = config.get("backpacks.digger.items", CONFIG_CATEGORY, ""); diff --git a/src/main/resources/config/forestry/gamemodes/EASY.cfg b/src/main/resources/config/forestry/gamemodes/EASY.cfg new file mode 100644 index 000000000..7715b30b5 --- /dev/null +++ b/src/main/resources/config/forestry/gamemodes/EASY.cfg @@ -0,0 +1,143 @@ +# Configuration file + +energy { + # modifies the energy required to activate machines, as well as the max amount of energy stored and accepted. + D:demand.modifier=1.0 + + # set to false to disable the clockwork engine. + B:engine.clockwork=true +} + + +farms { + # modifies the time a piece of fertilizer lasts in a farm. + I:fertilizer.value=2000 +} + + +fermenter { + + cycles { + # modifies the amount of cycles compost can keep a fermenter going. + I:compost=250 + + # modifies the amount of cycles fertilizer can keep a fermenter going. + I:fertilizer=200 + } + + value { + # modifies the amount of biomass per cycle a fermenter will produce using compost. + I:compost=48 + + # modifies the amount of biomass per cycle a fermenter will produce using fertilizer. + I:fertilizer=56 + } + + yield { + # modifies the amount of biomass a piece of cactus will yield in a fermenter. + I:cactus=50 + + # modifies the amount of biomass a piece of sugar cane will yield in a fermenter. + I:cane=50 + + # modifies the amount of biomass a mushroom will yield in a fermenter. + I:mushroom=50 + + # modifies the base amount of biomass a sapling will yield in a fermenter, affected by sappiness trait. + I:sapling=250 + + # modifies the amount of biomass a piece of wheat will yield in a fermenter. + I:wheat=50 + } + +} + + +fuel { + + ethanol { + # modifies the energy provided by ethanol in Buildcraft Combustion Engines. + D:combustion=1.0 + + # modifies the energy provided by ethanol in a Bio Generator. + D:generator=1.0 + } + + biomass { + # modifies the energy provided by Biomass in Biogas Engines. + D:biogas=1.0 + + # modifies the energy provided by Biomass in a Bio Generator. + D:generator=1.0 + } + +} + + +recipe { + + output { + # amount yielded by the recipe for tin cans. + I:can=12 + + # amount yielded by the recipe for wax capsules. + I:capsule=4 + + # amount yielded by the recipe for refractory capsules. + I:refractory=4 + + fertilizer { + # amount of fertilizer yielded by the recipe using apatite. + I:apatite=8 + + # amount of fertilizer yielded by the recipe using ash. + I:ash=16 + } + + compost { + # amount of compost yielded by the recipe using ash. + I:ash=1 + + # amount of compost yielded by the recipe using wheat. + I:wheat=4 + } + + humus { + # amount of humus yielded by the recipe using compost. + I:compost=8 + + # amount of humus yielded by the recipe using fertilizer. + I:fertilizer=8 + } + + bogearth { + # amount of bog earth yielded by the recipe using buckets. + I:bucket=6 + + # amount of bog earth yielded by the recipes using cans, cells or capsules. + I:can=8 + } + + } + +} + + +squeezer { + + liquid { + # modifies the amount of juice squeezed from a single apple. other sources are based off this. + I:apple=200 + + # modifies the amount of seed oil squeezed from a single seed. other sources are based off this. + I:seed=10 + } + + mulch { + # modifies the chance of mulch per squeezed apple. + I:apple=20 + } + +} + + diff --git a/src/main/resources/config/forestry/gamemodes/HARD.cfg b/src/main/resources/config/forestry/gamemodes/HARD.cfg new file mode 100644 index 000000000..0b2d4bdfa --- /dev/null +++ b/src/main/resources/config/forestry/gamemodes/HARD.cfg @@ -0,0 +1,143 @@ +# Configuration file + +energy { + # modifies the energy required to activate machines, as well as the max amount of energy stored and accepted. + D:demand.modifier=4.0 + + # set to false to disable the clockwork engine. + B:engine.clockwork=true +} + + +farms { + # modifies the time a piece of fertilizer lasts in a farm. + I:fertilizer.value=500 +} + + +fermenter { + + cycles { + # modifies the amount of cycles compost can keep a fermenter going. + I:compost=150 + + # modifies the amount of cycles fertilizer can keep a fermenter going. + I:fertilizer=100 + } + + value { + # modifies the amount of biomass per cycle a fermenter will produce using compost. + I:compost=48 + + # modifies the amount of biomass per cycle a fermenter will produce using fertilizer. + I:fertilizer=56 + } + + yield { + # modifies the amount of biomass a piece of cactus will yield in a fermenter. + I:cactus=10 + + # modifies the amount of biomass a piece of sugar cane will yield in a fermenter. + I:cane=10 + + # modifies the amount of biomass a mushroom will yield in a fermenter. + I:mushroom=10 + + # modifies the base amount of biomass a sapling will yield in a fermenter, affected by sappiness trait. + I:sapling=50 + + # modifies the amount of biomass a piece of wheat will yield in a fermenter. + I:wheat=10 + } + +} + + +fuel { + + ethanol { + # modifies the energy provided by ethanol in Buildcraft Combustion Engines. + D:combustion=0.5 + + # modifies the energy provided by ethanol in a Bio Generator. + D:generator=0.5 + } + + biomass { + # modifies the energy provided by Biomass in Biogas Engines. + D:biogas=0.5 + + # modifies the energy provided by Biomass in a Bio Generator. + D:generator=0.5 + } + +} + + +recipe { + + output { + # amount yielded by the recipe for tin cans. + I:can=8 + + # amount yielded by the recipe for wax capsules. + I:capsule=2 + + # amount yielded by the recipe for refractory capsules. + I:refractory=2 + + fertilizer { + # amount of fertilizer yielded by the recipe using apatite. + I:apatite=5 + + # amount of fertilizer yielded by the recipe using ash. + I:ash=0 + } + + compost { + # amount of compost yielded by the recipe using ash. + I:ash=1 + + # amount of compost yielded by the recipe using wheat. + I:wheat=1 + } + + humus { + # amount of humus yielded by the recipe using compost. + I:compost=8 + + # amount of humus yielded by the recipe using fertilizer. + I:fertilizer=8 + } + + bogearth { + # amount of bog earth yielded by the recipe using buckets. + I:bucket=4 + + # amount of bog earth yielded by the recipes using cans, cells or capsules. + I:can=5 + } + + } + +} + + +squeezer { + + liquid { + # modifies the amount of juice squeezed from a single apple. other sources are based off this. + I:apple=200 + + # modifies the amount of seed oil squeezed from a single seed. other sources are based off this. + I:seed=3 + } + + mulch { + # modifies the chance of mulch per squeezed apple. + I:apple=20 + } + +} + + diff --git a/src/main/resources/config/forestry/gamemodes/HARD.conf b/src/main/resources/config/forestry/gamemodes/HARD.conf deleted file mode 100755 index b3bf54171..000000000 --- a/src/main/resources/config/forestry/gamemodes/HARD.conf +++ /dev/null @@ -1,95 +0,0 @@ -# Forestry -# @VERSION@ (@BUILD_NUMBER@) -# -# Config files: -# base.conf - Contains Forge configuration for block and item ids -# common.conf - Contains all options common to Forestry -# apiculture.conf - Contains all options for bee breeding -# backpacks.conf - Contains custom configurations for backpacks -# pipes.conf - Configures item id for the apiarist's pipe -# gamemodes/ - Configures available gamemodes - -##################### -# ENERGY -##################### -# modifies the energy required to activate machines, as well as the max amount of energy stored and accepted. -energy.demand.modifier=4.0 -# set to false to disable the clockwork engine. -energy.engine.clockwork=true - - -##################### -# FUEL -##################### -# modifies the energy provided by ethanol in a Bio Generator. -fuel.ethanol.generator=0.5 -# modifies the energy provided by ethanol in Buildcraft Combustion Engines. -fuel.ethanol.combustion=0.5 -# modifies the energy provided by Biomass in a Bio Generator. -fuel.biomass.generator=0.5 -# modifies the energy provided by Biomass in Biogas Engines. -fuel.biomass.biogas=0.5 - - -##################### -# FARMS -##################### -# modifies the time fertilizer lasts in a farm. -farms.fertilizer.value=500 - - -##################### -# FERMENTER -##################### -# modifies the amount of cycles a fertilizer can keep a fermenter going. -fermenter.cycles.fertilizer=100 -# modifies the amount of cycles compost can keep a fermenter going. -fermenter.cycles.compost=150 -# modifies the amount of biomass per cycle a fermenter will produce using fertilizer. -fermenter.value.fertilizer=56 -# modifies the amount of biomass per cycle a fermenter will produce using compost. -fermenter.value.compost=48 -# modifies the amount of biomass a sapling will yield in a fermenter. -fermenter.yield.sapling=50 -# modifies the amount of biomass a piece of cactus will yield in a fermenter. -fermenter.yield.cactus=10 -# modifies the amount of biomass a piece of wheat will yield in a fermenter. -fermenter.yield.wheat=10 -# modifies the amount of biomass a mushroom will yield in a fermenter. -fermenter.yield.mushroom=10 -# modifies the amount of biomass a piece of sugar cane will yield in a fermenter. -fermenter.yield.cane=10 - - -##################### -# RECIPE -##################### -# amount of fertilizer yielded by the recipe using apatite. -recipe.output.fertilizer.apatite=5 -# amount of fertilizer yielded by the recipe using ash. -recipe.output.fertilizer.ash=0 -# amount of bog earth yielded by the recipe using buckets. -recipe.output.bogearth.bucket=4 -# amount of bog earth yielded by the recipes using cans, cells or capsules. -recipe.output.bogearth.can=5 -# amount yielded by the recipe for tin cans. -recipe.output.can=8 -# amount yielded by the recipe for wax capsules. -recipe.output.capsule=2 -# amount yielded by the recipe for refractory capsules. -recipe.output.refractory=2 -# amount of compost yielded by the recipe using wheat. -recipe.output.compost.wheat=1 -# amount of compost yielded by the recipe using ash. -recipe.output.compost.ash=1 -# amount of humus yielded by the recipe using fertilizer. -recipe.output.humus.fertilizer=8 -# amount of humus yielded by the recipe using compost. -recipe.output.humus.compost=8 - - -##################### -# SQUEEZER -##################### -# modifies the amount of seed oil squeezed from a single seed. -squeezer.liquid.seed=3 diff --git a/src/main/resources/config/forestry/gamemodes/NORMAL.cfg b/src/main/resources/config/forestry/gamemodes/NORMAL.cfg new file mode 100644 index 000000000..7fac8dfc8 --- /dev/null +++ b/src/main/resources/config/forestry/gamemodes/NORMAL.cfg @@ -0,0 +1,143 @@ +# Configuration file + +energy { + # modifies the energy required to activate machines, as well as the max amount of energy stored and accepted. + D:demand.modifier=1.5 + + # set to false to disable the clockwork engine. + B:engine.clockwork=true +} + + +farms { + # modifies the time a piece of fertilizer lasts in a farm. + I:fertilizer.value=1000 +} + + +fermenter { + + cycles { + # modifies the amount of cycles compost can keep a fermenter going. + I:compost=200 + + # modifies the amount of cycles fertilizer can keep a fermenter going. + I:fertilizer=150 + } + + value { + # modifies the amount of biomass per cycle a fermenter will produce using compost. + I:compost=48 + + # modifies the amount of biomass per cycle a fermenter will produce using fertilizer. + I:fertilizer=56 + } + + yield { + # modifies the amount of biomass a piece of cactus will yield in a fermenter. + I:cactus=25 + + # modifies the amount of biomass a piece of sugar cane will yield in a fermenter. + I:cane=25 + + # modifies the amount of biomass a mushroom will yield in a fermenter. + I:mushroom=25 + + # modifies the base amount of biomass a sapling will yield in a fermenter, affected by sappiness trait. + I:sapling=100 + + # modifies the amount of biomass a piece of wheat will yield in a fermenter. + I:wheat=25 + } + +} + + +fuel { + + ethanol { + # modifies the energy provided by ethanol in Buildcraft Combustion Engines. + D:combustion=0.75 + + # modifies the energy provided by ethanol in a Bio Generator. + D:generator=0.75 + } + + biomass { + # modifies the energy provided by Biomass in Biogas Engines. + D:biogas=0.75 + + # modifies the energy provided by Biomass in a Bio Generator. + D:generator=0.75 + } + +} + + +recipe { + + output { + # amount yielded by the recipe for tin cans. + I:can=10 + + # amount yielded by the recipe for wax capsules. + I:capsule=3 + + # amount yielded by the recipe for refractory capsules. + I:refractory=3 + + fertilizer { + # amount of fertilizer yielded by the recipe using apatite. + I:apatite=6 + + # amount of fertilizer yielded by the recipe using ash. + I:ash=10 + } + + compost { + # amount of compost yielded by the recipe using ash. + I:ash=1 + + # amount of compost yielded by the recipe using wheat. + I:wheat=2 + } + + humus { + # amount of humus yielded by the recipe using compost. + I:compost=8 + + # amount of humus yielded by the recipe using fertilizer. + I:fertilizer=8 + } + + bogearth { + # amount of bog earth yielded by the recipe using buckets. + I:bucket=4 + + # amount of bog earth yielded by the recipes using cans, cells or capsules. + I:can=6 + } + + } + +} + + +squeezer { + + liquid { + # modifies the amount of juice squeezed from a single apple. other sources are based off this. + I:apple=200 + + # modifies the amount of seed oil squeezed from a single seed. other sources are based off this. + I:seed=5 + } + + mulch { + # modifies the chance of mulch per squeezed apple. + I:apple=20 + } + +} + + diff --git a/src/main/resources/config/forestry/gamemodes/NORMAL.conf b/src/main/resources/config/forestry/gamemodes/NORMAL.conf deleted file mode 100755 index b1a5f8f78..000000000 --- a/src/main/resources/config/forestry/gamemodes/NORMAL.conf +++ /dev/null @@ -1,96 +0,0 @@ -# Forestry -# @VERSION@ (@BUILD_NUMBER@) -# -# Config files: -# base.conf - Contains Forge configuration for block and item ids -# common.conf - Contains all options common to Forestry -# apiculture.conf - Contains all options for bee breeding -# backpacks.conf - Contains custom configurations for backpacks -# pipes.conf - Configures item id for the apiarist's pipe -# gamemodes/ - Configures available gamemodes - -##################### -# ENERGY -##################### -# modifies the energy required to activate machines, as well as the max amount of energy stored and accepted. -energy.demand.modifier=1.5 -# set to false to disable the clockwork engine. -energy.engine.clockwork=true - - -##################### -# FUEL -##################### -# modifies the energy provided by ethanol in a Bio Generator. -fuel.ethanol.generator=0.75 -# modifies the energy provided by ethanol in Buildcraft Combustion Engines. -fuel.ethanol.combustion=0.75 -# modifies the energy provided by Biomass in a Bio Generator. -fuel.biomass.generator=0.75 -# modifies the energy provided by Biomass in Biogas Engines. -fuel.biomass.biogas=0.75 - - -##################### -# FARMS -##################### -# modifies the time fertilizer lasts in a farm. -farms.fertilizer.value=1000 - - -##################### -# FERMENTER -##################### -# modifies the amount of cycles a fertilizer can keep a fermenter going. -fermenter.cycles.fertilizer=150 -# modifies the amount of cycles compost can keep a fermenter going. -fermenter.cycles.compost=200 -# modifies the amount of biomass per cycle a fermenter will produce using fertilizer. -fermenter.value.fertilizer=56 -# modifies the amount of biomass per cycle a fermenter will produce using compost. -fermenter.value.compost=48 -# modifies the amount of biomass a sapling will yield in a fermenter. -fermenter.yield.sapling=100 -# modifies the amount of biomass a piece of cactus will yield in a fermenter. -fermenter.yield.cactus=25 -# modifies the amount of biomass a piece of wheat will yield in a fermenter. -fermenter.yield.wheat=25 -# modifies the amount of biomass a mushroom will yield in a fermenter. -fermenter.yield.mushroom=25 -# modifies the amount of biomass a piece of sugar cane will yield in a fermenter. -fermenter.yield.cane=25 - - -##################### -# RECIPE -##################### -# amount of fertilizer yielded by the recipe using apatite. -recipe.output.fertilizer.apatite=6 -# amount of fertilizer yielded by the recipe using ash. -recipe.output.fertilizer.ash=10 -# amount of bog earth yielded by the recipe using buckets. -recipe.output.bogearth.bucket=4 -# amount of bog earth yielded by the recipes using cans, cells or capsules. -recipe.output.bogearth.can=6 -# amount yielded by the recipe for tin cans. -recipe.output.can=10 -# amount yielded by the recipe for wax capsules. -recipe.output.capsule=3 -# amount yielded by the recipe for refractory capsules. -recipe.output.refractory=3 -# amount of compost yielded by the recipe using wheat. -recipe.output.compost.wheat=2 -# amount of compost yielded by the recipe using ash. -recipe.output.compost.ash=1 -# amount of humus yielded by the recipe using fertilizer. -recipe.output.humus.fertilizer=8 -# amount of humus yielded by the recipe using compost. -recipe.output.humus.compost=8 - - -##################### -# SQUEEZER -##################### -# modifies the amount of seed oil squeezed from a single seed. -squeezer.liquid.seed=5 - diff --git a/src/main/resources/config/forestry/gamemodes/OP.cfg b/src/main/resources/config/forestry/gamemodes/OP.cfg new file mode 100644 index 000000000..db8cdbeb3 --- /dev/null +++ b/src/main/resources/config/forestry/gamemodes/OP.cfg @@ -0,0 +1,143 @@ +# Configuration file + +energy { + # modifies the energy required to activate machines, as well as the max amount of energy stored and accepted. + D:demand.modifier=1.0 + + # set to false to disable the clockwork engine. + B:engine.clockwork=true +} + + +farms { + # modifies the time a piece of fertilizer lasts in a farm. + I:fertilizer.value=-1 +} + + +fermenter { + + cycles { + # modifies the amount of cycles compost can keep a fermenter going. + I:compost=1000 + + # modifies the amount of cycles fertilizer can keep a fermenter going. + I:fertilizer=800 + } + + value { + # modifies the amount of biomass per cycle a fermenter will produce using compost. + I:compost=192 + + # modifies the amount of biomass per cycle a fermenter will produce using fertilizer. + I:fertilizer=224 + } + + yield { + # modifies the amount of biomass a piece of cactus will yield in a fermenter. + I:cactus=400 + + # modifies the amount of biomass a piece of sugar cane will yield in a fermenter. + I:cane=400 + + # modifies the amount of biomass a mushroom will yield in a fermenter. + I:mushroom=400 + + # modifies the base amount of biomass a sapling will yield in a fermenter, affected by sappiness trait. + I:sapling=2000 + + # modifies the amount of biomass a piece of wheat will yield in a fermenter. + I:wheat=400 + } + +} + + +fuel { + + ethanol { + # modifies the energy provided by ethanol in Buildcraft Combustion Engines. + D:combustion=4.0 + + # modifies the energy provided by ethanol in a Bio Generator. + D:generator=4.0 + } + + biomass { + # modifies the energy provided by Biomass in Biogas Engines. + D:biogas=4.0 + + # modifies the energy provided by Biomass in a Bio Generator. + D:generator=4.0 + } + +} + + +recipe { + + output { + # amount yielded by the recipe for tin cans. + I:can=24 + + # amount yielded by the recipe for wax capsules. + I:capsule=8 + + # amount yielded by the recipe for refractory capsules. + I:refractory=8 + + fertilizer { + # amount of fertilizer yielded by the recipe using apatite. + I:apatite=16 + + # amount of fertilizer yielded by the recipe using ash. + I:ash=32 + } + + compost { + # amount of compost yielded by the recipe using ash. + I:ash=2 + + # amount of compost yielded by the recipe using wheat. + I:wheat=8 + } + + humus { + # amount of humus yielded by the recipe using compost. + I:compost=8 + + # amount of humus yielded by the recipe using fertilizer. + I:fertilizer=8 + } + + bogearth { + # amount of bog earth yielded by the recipe using buckets. + I:bucket=6 + + # amount of bog earth yielded by the recipes using cans, cells or capsules. + I:can=8 + } + + } + +} + + +squeezer { + + liquid { + # modifies the amount of juice squeezed from a single apple. other sources are based off this. + I:apple=1600 + + # modifies the amount of seed oil squeezed from a single seed. other sources are based off this. + I:seed=80 + } + + mulch { + # modifies the chance of mulch per squeezed apple. + I:apple=160 + } + +} + + diff --git a/src/main/resources/config/forestry/gamemodes/OP.conf b/src/main/resources/config/forestry/gamemodes/OP.conf deleted file mode 100755 index 4e3261c68..000000000 --- a/src/main/resources/config/forestry/gamemodes/OP.conf +++ /dev/null @@ -1,99 +0,0 @@ -# Forestry -# @VERSION@ (@BUILD_NUMBER@) -# -# Config files: -# base.conf - Contains Forge configuration for block and item ids -# common.conf - Contains all options common to Forestry -# apiculture.conf - Contains all options for bee breeding -# backpacks.conf - Contains custom configurations for backpacks -# pipes.conf - Configures item id for the apiarist's pipe -# gamemodes/ - Configures available gamemodes - -##################### -# ENERGY -##################### -# modifies the energy required to activate machines, as well as the max amount of energy stored and accepted. -energy.demand.modifier=1.0 -# set to false to disable the clockwork engine. -energy.engine.clockwork=true - - -##################### -# FUEL -##################### -# modifies the energy provided by ethanol in a Bio Generator. -fuel.ethanol.generator=4.0 -# modifies the energy provided by ethanol in Buildcraft Combustion Engines. -fuel.ethanol.combustion=4.0 -# modifies the energy provided by Biomass in a Bio Generator. -fuel.biomass.generator=4.0 -# modifies the energy provided by Biomass in Biogas Engines. -fuel.biomass.biogas=4.0 - - -##################### -# FARMS -##################### -# modifies the time fertilizer lasts in a farm. -farms.fertilizer.value=-1 - - -##################### -# FERMENTER -##################### -# modifies the amount of cycles fertilizer can keep a fermenter going. -fermenter.cycles.fertilizer=800 -# modifies the amount of cycles compost can keep a fermenter going. -fermenter.cycles.compost=1000 -# modifies the amount of biomass per cycle a fermenter will produce using fertilizer. -fermenter.value.fertilizer=224 -# modifies the amount of biomass per cycle a fermenter will produce using compost. -fermenter.value.compost=192 -# modifies the base amount of biomass a sapling will yield in a fermenter, affected by sappiness trait. (max: 2000) -fermenter.yield.sapling=2000 -# modifies the amount of biomass a piece of cactus will yield in a fermenter. (max: 400) -fermenter.yield.cactus=400 -# modifies the amount of biomass a piece of wheat will yield in a fermenter. (max: 400) -fermenter.yield.wheat=400 -# modifies the amount of biomass a piece of sugar cane will yield in a fermenter. (max: 400) -fermenter.yield.cane=400 -# modifies the amount of biomass a mushroom will yield in a fermenter. (max: 400) -fermenter.yield.mushroom=400 - - -##################### -# RECIPE -##################### -# amount of fertilizer yielded by the recipe using apatite. -recipe.output.fertilizer.apatite=16 -# amount of fertilizer yielded by the recipe using ash. -recipe.output.fertilizer.ash=32 -# amount of compost yielded by the recipe using wheat. -recipe.output.compost.wheat=8 -# amount of compost yielded by the recipe using ash. -recipe.output.compost.ash=2 -# amount of humus yielded by the recipe using fertilizer. -recipe.output.humus.fertilizer=8 -# amount of humus yielded by the recipe using compost. -recipe.output.humus.compost=8 -# amount of bog earth yielded by the recipe using buckets. -recipe.output.bogearth.bucket=6 -# amount of bog earth yielded by the recipes using cans, cells or capsules. -recipe.output.bogearth.can=8 -# amount yielded by the recipe for tin cans. -recipe.output.can=24 -# amount yielded by the recipe for wax capsules. -recipe.output.capsule=8 -# amount yielded by the recipe for refractory capsules. -recipe.output.refractory=8 - - -##################### -# SQUEEZER -##################### -# modifies the amount of seed oil squeezed from a single seed. other sources are based off this. (max: 80) -squeezer.liquid.seed=80 -# modifies the amount of juice squeezed from a single apple. other sources are based off this. (max: 1600) -squeezer.liquid.apple=1600 -# modifies the chance of mulch per squeezed apple. (max: 160) -squeezer.mulch.apple=160