mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-18 19:29:17 +00:00
Localize Configs #507
This commit is contained in:
1 parent
117fd7235c
commit
3e9e4afbfd
13 files changed
+633
-727
No files matched your search
@@ -17,15 +17,13 @@ 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.ForestryBlock;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.config.LocalizedConfiguration;
|
||||
import forestry.core.proxy.Proxies;
|
||||
|
||||
public class GameMode implements IGameMode {
|
||||
@@ -39,6 +37,7 @@ public class GameMode implements IGameMode {
|
||||
return ForestryAPI.activeMode;
|
||||
}
|
||||
|
||||
private static final String GAMEMODE_KEY = "gamemode";
|
||||
private String identifier = "EASY";
|
||||
private final String category;
|
||||
|
||||
@@ -102,45 +101,46 @@ public class GameMode implements IGameMode {
|
||||
}
|
||||
}
|
||||
|
||||
Configuration config = new Configuration(newConfigFile);
|
||||
LocalizedConfiguration config = new LocalizedConfiguration(newConfigFile, "1.0.0");
|
||||
|
||||
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.");
|
||||
initSettingFloat(config, "energy", "demand.modifier", ENERGY_DEMAND_MODIFIER);
|
||||
initSettingBoolean(config, "energy", "engine.clockwork", true);
|
||||
|
||||
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.");
|
||||
initSettingInt(config, "farms", "fertilizer.value", FARM_FERTILIZER_VALUE);
|
||||
|
||||
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.");
|
||||
initSettingFloat(config, "fuel.ethanol", "generator", FUEL_MODIFIER);
|
||||
initSettingFloat(config, "fuel.ethanol", "combustion", FUEL_MODIFIER);
|
||||
initSettingFloat(config, "fuel.biomass", "generator", FUEL_MODIFIER);
|
||||
initSettingFloat(config, "fuel.biomass", "biogas", FUEL_MODIFIER);
|
||||
|
||||
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.");
|
||||
initSettingStack(config, "recipe.output.fertilizer", "apatite", recipeFertilizerOutputApatite);
|
||||
initSettingStack(config, "recipe.output.fertilizer", "ash", recipeFertilizerOutputAsh);
|
||||
initSettingStack(config, "recipe.output.compost", "wheat", recipeCompostOutputWheat);
|
||||
initSettingStack(config, "recipe.output.compost", "ash", recipeCompostOutputAsh);
|
||||
initSettingStack(config, "recipe.output.humus", "fertilizer", recipeHumusOutputFertilizer);
|
||||
initSettingStack(config, "recipe.output.humus", "compost", recipeHumusOutputCompost);
|
||||
initSettingStack(config, "recipe.output.bogearth", "bucket", recipeBogEarthOutputBucket);
|
||||
initSettingStack(config, "recipe.output.bogearth", "can", recipeBogEarthOutputCans);
|
||||
initSettingStack(config, "recipe.output", "can", recipeCanOutput);
|
||||
initSettingStack(config, "recipe.output", "capsule", recipeCapsuleOutput);
|
||||
initSettingStack(config, "recipe.output", "refractory", recipeRefractoryOutput);
|
||||
|
||||
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.");
|
||||
initSettingInt(config, "fermenter.cycles", "fertilizer", FERMENTATION_DURATION_FERTILIZER);
|
||||
initSettingInt(config, "fermenter.cycles", "compost", FERMENTATION_DURATION_COMPOST);
|
||||
|
||||
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.value", "fertilizer", FERMENTED_CYCLE_FERTILIZER);
|
||||
initSettingInt(config, "fermenter.value", "compost", FERMENTED_CYCLE_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, "fermenter.yield", "sapling", FERMENTED_SAPLING);
|
||||
initSettingInt(config, "fermenter.yield", "cactus", FERMENTED_CACTI);
|
||||
initSettingInt(config, "fermenter.yield", "wheat", FERMENTED_WHEAT);
|
||||
initSettingInt(config, "fermenter.yield", "cane", FERMENTED_CANE);
|
||||
initSettingInt(config, "fermenter.yield", "mushroom", FERMENTED_MUSHROOM);
|
||||
|
||||
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.");
|
||||
initSettingInt(config, "squeezer.liquid", "seed", SQUEEZED_LIQUID_SEED);
|
||||
initSettingInt(config, "squeezer.liquid", "apple", SQUEEZED_LIQUID_APPLE);
|
||||
|
||||
initSettingInt(config, "squeezer.mulch", "apple", SQUEEZED_MULCH_APPLE);
|
||||
|
||||
config.save();
|
||||
}
|
||||
@@ -185,20 +185,20 @@ public class GameMode implements IGameMode {
|
||||
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;
|
||||
private void initSettingFloat(LocalizedConfiguration config, String category, String name, float def) {
|
||||
String fullName = category + '.' + name;
|
||||
// legacy conversion of old format to new format
|
||||
{
|
||||
Float oldSetting = floatSettings.get(fullKey);
|
||||
Float oldSetting = floatSettings.get(fullName);
|
||||
if (oldSetting != null) {
|
||||
def = oldSetting;
|
||||
}
|
||||
}
|
||||
Property property = config.get(category, key, def, comment);
|
||||
floatSettings.put(fullKey, (float) property.getDouble());
|
||||
float floatValue = config.getFloatLocalized(GAMEMODE_KEY + '.' + category, name, def, 0.0f, 10.0f);
|
||||
floatSettings.put(fullName, floatValue);
|
||||
}
|
||||
|
||||
private void initSettingInt(Configuration config, String category, String key, int def, String comment) {
|
||||
private void initSettingInt(LocalizedConfiguration config, String category, String key, int def) {
|
||||
String fullKey = category + '.' + key;
|
||||
// legacy conversion of old format to new format
|
||||
{
|
||||
@@ -207,11 +207,11 @@ public class GameMode implements IGameMode {
|
||||
def = oldSetting;
|
||||
}
|
||||
}
|
||||
Property property = config.get(category, key, def, comment);
|
||||
integerSettings.put(fullKey, property.getInt());
|
||||
int intValue = config.getIntLocalized(GAMEMODE_KEY + '.' + category, key, def, 0, 2000);
|
||||
integerSettings.put(fullKey, intValue);
|
||||
}
|
||||
|
||||
private void initSettingStack(Configuration config, String category, String key, ItemStack def, String comment) {
|
||||
private void initSettingStack(LocalizedConfiguration config, String category, String key, ItemStack def) {
|
||||
String fullKey = category + '.' + key;
|
||||
// legacy conversion of old format to new format
|
||||
{
|
||||
@@ -220,13 +220,13 @@ public class GameMode implements IGameMode {
|
||||
def = oldSetting;
|
||||
}
|
||||
}
|
||||
Property property = config.get(category, key, def.stackSize, comment);
|
||||
int stackSize = config.getIntLocalized(GAMEMODE_KEY + '.' + category, key, def.stackSize, 0, 64);
|
||||
ItemStack changed = def.copy();
|
||||
changed.stackSize = property.getInt();
|
||||
changed.stackSize = stackSize;
|
||||
stackSettings.put(fullKey, changed);
|
||||
}
|
||||
|
||||
private void initSettingBoolean(Configuration config, String category, String key, boolean def, String comment) {
|
||||
private void initSettingBoolean(LocalizedConfiguration config, String category, String key, boolean def) {
|
||||
String fullKey = category + '.' + key;
|
||||
// legacy conversion of old format to new format
|
||||
{
|
||||
@@ -235,8 +235,8 @@ public class GameMode implements IGameMode {
|
||||
def = oldSetting;
|
||||
}
|
||||
}
|
||||
Property property = config.get(category, key, def, comment);
|
||||
booleanSettings.put(fullKey, property.getBoolean());
|
||||
boolean booleanValue = config.getBooleanLocalized(GAMEMODE_KEY + '.' + category, key, def);
|
||||
booleanSettings.put(fullKey, booleanValue);
|
||||
}
|
||||
|
||||
private void initSettingStack_old(String ident, ItemStack def, String comment) {
|
||||
|
||||
@@ -22,12 +22,14 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
import forestry.Forestry;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class Config {
|
||||
|
||||
@@ -60,9 +62,9 @@ public class Config {
|
||||
public static boolean generateApatiteOre = true;
|
||||
public static boolean generateCopperOre = true;
|
||||
public static boolean generateTinOre = true;
|
||||
private static double generateBeehivesAmount = 1.0;
|
||||
private static float generateBeehivesAmount = 1.0f;
|
||||
public static boolean generateBeehivesDebug = false;
|
||||
public static boolean enableVillager = true;
|
||||
public static boolean enableVillagers = true;
|
||||
|
||||
// Retrogen
|
||||
public static boolean doRetrogen = false;
|
||||
@@ -171,170 +173,102 @@ public class Config {
|
||||
|
||||
private static void loadNewConfigCommon(File configFileCommon) {
|
||||
|
||||
Configuration config = new Configuration(configFileCommon);
|
||||
LocalizedConfiguration config = new LocalizedConfiguration(configFileCommon, "1.0.0");
|
||||
|
||||
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 = property.getBoolean();
|
||||
property.set(false);
|
||||
gameMode = config.getStringLocalized("difficulty", "game.mode", "EASY", new String[]{"OP, EASY, NORMAL, HARD"});
|
||||
|
||||
boolean recreate = config.getBooleanLocalized("difficulty", "recreate.definitions", true);
|
||||
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 = new File(Forestry.instance.getConfigFolder(), "gamemodes/EASY.cfg");
|
||||
if (recreate) {
|
||||
String recreateDefinitionsComment = StringUtil.localize("config.difficulty.recreate.definitions.comment");
|
||||
Property property = config.get("difficulty", "recreate.definitions", true, recreateDefinitionsComment);
|
||||
property.set(false);
|
||||
|
||||
// Make sure the default mode files are there.
|
||||
File easyMode = new File(Forestry.instance.getConfigFolder(), "gamemodes/EASY.cfg");
|
||||
CopyFileToFS(easyMode, "/config/forestry/gamemodes/EASY.cfg");
|
||||
}
|
||||
|
||||
File opMode = new File(Forestry.instance.getConfigFolder(), "gamemodes/OP.cfg");
|
||||
if (!opMode.exists() || recreate) {
|
||||
File opMode = new File(Forestry.instance.getConfigFolder(), "gamemodes/OP.cfg");
|
||||
CopyFileToFS(opMode, "/config/forestry/gamemodes/OP.cfg");
|
||||
}
|
||||
|
||||
File normalMode = new File(Forestry.instance.getConfigFolder(), "gamemodes/NORMAL.cfg");
|
||||
if (!normalMode.exists() || recreate) {
|
||||
File normalMode = new File(Forestry.instance.getConfigFolder(), "gamemodes/NORMAL.cfg");
|
||||
CopyFileToFS(normalMode, "/config/forestry/gamemodes/NORMAL.cfg");
|
||||
}
|
||||
|
||||
File hardMode = new File(Forestry.instance.getConfigFolder(), "gamemodes/HARD.cfg");
|
||||
if (!hardMode.exists() || recreate) {
|
||||
File hardMode = new File(Forestry.instance.getConfigFolder(), "gamemodes/HARD.cfg");
|
||||
CopyFileToFS(hardMode, "/config/forestry/gamemodes/HARD.cfg");
|
||||
}
|
||||
|
||||
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();
|
||||
enableParticleFX = config.getBooleanLocalized("performance", "particleFX", enableParticleFX);
|
||||
|
||||
// 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();
|
||||
doRetrogen = config.getBooleanLocalized("world.generate.retrogen", "normal", doRetrogen);
|
||||
forceRetrogen = config.getBooleanLocalized("world.generate.retrogen", "forced", forceRetrogen);
|
||||
|
||||
if (forceRetrogen) {
|
||||
Proxies.log.info(forcedRetroGenMessage);
|
||||
Property property = config.get("world.generate.retrogen", "forced", false);
|
||||
property.set(false);
|
||||
|
||||
Proxies.log.info("Enabled force retrogen.");
|
||||
doRetrogen = true;
|
||||
} else if (doRetrogen) {
|
||||
Proxies.log.info(retroGenMessage);
|
||||
Proxies.log.info("Enabled retrogen.");
|
||||
}
|
||||
|
||||
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();
|
||||
generateBeehivesAmount = config.getFloatLocalized("world.generate.beehives", "amount", generateBeehivesAmount, 0.0f, 10.0f);
|
||||
generateBeehivesDebug = config.getBooleanLocalized("world.generate.beehives", "debug", generateBeehivesDebug);
|
||||
|
||||
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();
|
||||
generateApatiteOre = config.getBooleanLocalized("world.generate.ore", "apatite", generateApatiteOre);
|
||||
generateCopperOre = config.getBooleanLocalized("world.generate.ore", "copper", generateCopperOre);
|
||||
generateTinOre = config.getBooleanLocalized("world.generate.ore", "tin", generateTinOre);
|
||||
|
||||
property = config.get("world.generate.ore", "apatite", generateApatiteOre);
|
||||
property.comment = "Generate apatite ore blocks in the world";
|
||||
generateApatiteOre = property.getBoolean();
|
||||
enableVillagers = config.getBooleanLocalized("world.generate", "villagers", enableVillagers);
|
||||
|
||||
property = config.get("world.generate.ore", "copper", generateCopperOre);
|
||||
property.comment = "Generate copper ore blocks in the world";
|
||||
generateCopperOre = property.getBoolean();
|
||||
craftingBronzeEnabled = config.getBooleanLocalized("crafting", "bronze", craftingBronzeEnabled);
|
||||
craftingStampsEnabled = config.getBooleanLocalized("crafting.stamps", "enabled", true);
|
||||
|
||||
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.";
|
||||
String[] allStamps = new String[]{"1n", "2n", "5n", "10n", "20n", "50n", "100n"};
|
||||
String[] defaultCollectors = new String[]{"20n", "50n", "100n"};
|
||||
String[] stamps = config.getStringListLocalized("crafting.stamps", "disabled", defaultCollectors, allStamps);
|
||||
try {
|
||||
collectorStamps.addAll(Arrays.asList(property.getStringList()));
|
||||
collectorStamps.addAll(Arrays.asList(stamps));
|
||||
} catch (Exception ex) {
|
||||
Proxies.log.warning("Failed to read config for 'crafting.stamps.collector', setting to default.");
|
||||
Proxies.log.warning("Failed to read config for 'crafting.stamps.disabled', setting to default.");
|
||||
Property property = config.get("crafting.stamps", "disabled", defaultCollectors);
|
||||
property.setToDefault();
|
||||
collectorStamps.addAll(Arrays.asList(parseStamps(defaultCollectors)));
|
||||
collectorStamps.addAll(Arrays.asList(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();
|
||||
clearInvalidChromosomes = config.getBooleanLocalized("genetics", "clear.invalid.chromosomes", clearInvalidChromosomes);
|
||||
dungeonLootRare = config.getBooleanLocalized("difficulty", "loot.rare", dungeonLootRare);
|
||||
|
||||
property = config.get("difficulty", "dungeonloot.rare", dungeonLootRare);
|
||||
property.comment = "Make dungeon loot generated by forestry rarer";
|
||||
dungeonLootRare = property.getBoolean();
|
||||
enableBackpackResupply = config.getBooleanLocalized("performance.backpacks", "resupply", enableBackpackResupply);
|
||||
|
||||
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();
|
||||
mailAlertEnabled = config.getBooleanLocalized("tweaks.gui", "mail.alert", mailAlertEnabled);
|
||||
|
||||
property = config.get("tweaks.gui", "mail.alert", mailAlertEnabled);
|
||||
property.comment = "Display the mail alert box when you get mail.";
|
||||
mailAlertEnabled = property.getBoolean();
|
||||
guiTabSpeed = config.getIntLocalized("tweaks.gui.tabs", "speed", guiTabSpeed, 1, 50);
|
||||
enableHints = config.getBooleanLocalized("tweaks.gui.tabs", "hints", enableHints);
|
||||
enableEnergyStat = config.getBooleanLocalized("tweaks.gui.tabs", "energy", enableEnergyStat);
|
||||
|
||||
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();
|
||||
tooltipLiquidAmount = config.getBooleanLocalized("tweaks.gui.tooltip", "liquidamount", tooltipLiquidAmount);
|
||||
|
||||
property = config.get("tweaks.gui.tabs", "hints", enableHints);
|
||||
property.comment = "Display the hints tab on machine and engine guis.";
|
||||
enableHints = property.getBoolean();
|
||||
enablePermissions = config.getBooleanLocalized("tweaks", "permissions", enablePermissions);
|
||||
|
||||
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();
|
||||
squareFarms = config.getBooleanLocalized("tweaks.farms", "square", squareFarms);
|
||||
enableExUtilEnderLily = config.getBooleanLocalized("tweaks.farms", "enderlily", enableExUtilEnderLily);
|
||||
enableMagicalCropsSupport = config.getBooleanLocalized("tweaks.farms", "magicalcrops", enableMagicalCropsSupport);
|
||||
|
||||
String[] availableStructures = new String[]{"alveary3x3", "farm3x3", "farm3x4", "farm3x5", "farm4x4", "farm5x5"};
|
||||
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()));
|
||||
disabledStructureArray = config.getStringListLocalized("structures", "disabled", disabledStructureArray, availableStructures);
|
||||
|
||||
disabledStructures.addAll(Arrays.asList(disabledStructureArray));
|
||||
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();
|
||||
isDebug = config.getBooleanLocalized("debug", "enabled", isDebug);
|
||||
|
||||
config.save();
|
||||
}
|
||||
@@ -375,7 +309,7 @@ public class Config {
|
||||
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 = configOld.get("world.generate.beehives.rate", CATEGORY_COMMON, 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);
|
||||
|
||||
@@ -383,7 +317,7 @@ public class Config {
|
||||
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;
|
||||
generateBeehivesAmount = 0.0f;
|
||||
}
|
||||
|
||||
property = configOld.get("world.generate.beehives.debug", CATEGORY_DEBUG, false);
|
||||
@@ -400,7 +334,7 @@ public class Config {
|
||||
|
||||
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);
|
||||
enableVillagers = Boolean.parseBoolean(property.value);
|
||||
|
||||
property = configOld.get("crafting.bronze.enabled", CATEGORY_COMMON, true);
|
||||
property.comment = "set to false to disable crafting recipe for bronze";
|
||||
@@ -475,19 +409,22 @@ public class Config {
|
||||
}
|
||||
|
||||
private static void loadNewConfigFluids(File configFile) {
|
||||
net.minecraftforge.common.config.Configuration config = new net.minecraftforge.common.config.Configuration(configFile);
|
||||
LocalizedConfiguration config = new LocalizedConfiguration(configFile, "1.0.0");
|
||||
|
||||
net.minecraftforge.common.config.Property property;
|
||||
for (Fluids fluid : Fluids.forestryFluids) {
|
||||
String fluidName = StatCollector.translateToLocal("fluid." + fluid.getTag());
|
||||
|
||||
boolean enabledFluid = !Config.disabledFluids.contains(fluid.getTag());
|
||||
property = config.get("enableFluid", fluid.getTag(), enabledFluid);
|
||||
if (!property.getBoolean()) {
|
||||
String enableFluidComment = StringUtil.localizeAndFormatRaw("for.config.fluids.enable.format", fluidName);
|
||||
enabledFluid = config.getBoolean("enableFluid", fluid.getTag(), enabledFluid, enableFluidComment);
|
||||
if (!enabledFluid) {
|
||||
Config.disabledFluids.add(fluid.getTag());
|
||||
}
|
||||
|
||||
boolean enabledFluidBlock = !Config.disabledBlocks.contains(fluid.getTag());
|
||||
property = config.get("enableFluidBlock", fluid.getTag(), enabledFluidBlock);
|
||||
if (!property.getBoolean()) {
|
||||
String enableFluidBlockComment = StringUtil.localizeAndFormatRaw("for.config.fluid.blocks.enable.format", fluidName);
|
||||
enabledFluidBlock = config.getBoolean("enableFluidBlock", fluid.getTag(), enabledFluidBlock, enableFluidBlockComment);
|
||||
if (!enabledFluidBlock) {
|
||||
Config.disabledBlocks.add(fluid.getTag());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
public class LocalizedConfiguration extends Configuration {
|
||||
|
||||
public LocalizedConfiguration(File file, String configVersion) {
|
||||
super(file, configVersion);
|
||||
}
|
||||
|
||||
public Configuration setCategoryLanguageKey(String categoryName) {
|
||||
String categoryKey = "for.config" + categoryName;
|
||||
return super.setCategoryLanguageKey(categoryName, categoryKey);
|
||||
}
|
||||
|
||||
public boolean getBoolean(String category, String name, boolean defaultValue, String comment) {
|
||||
Property prop = this.get(category, name, defaultValue);
|
||||
prop.comment = comment + " [default: " + defaultValue + "]";
|
||||
return prop.getBoolean(defaultValue);
|
||||
}
|
||||
|
||||
public boolean getBooleanLocalized(String category, String name, boolean defaultValue) {
|
||||
String langKey = "for.config." + category + '.' + name;
|
||||
String commentKey = langKey + '.' + "comment";
|
||||
String comment = "";
|
||||
if (StatCollector.canTranslate(commentKey)) {
|
||||
comment = StatCollector.translateToLocal(commentKey);
|
||||
}
|
||||
return getBoolean(name, category, defaultValue, comment, langKey);
|
||||
}
|
||||
|
||||
public String getStringLocalized(String category, String name, String defaultValue) {
|
||||
String langKey = "for.config." + category + '.' + name;
|
||||
String commentKey = langKey + '.' + "comment";
|
||||
String comment = "";
|
||||
if (StatCollector.canTranslate(commentKey)) {
|
||||
comment = StatCollector.translateToLocal(commentKey);
|
||||
}
|
||||
return getString(name, category, defaultValue, comment, langKey);
|
||||
}
|
||||
|
||||
public String getStringLocalized(String category, String name, String defaultValue, String[] validValues) {
|
||||
String langKey = "for.config." + category + '.' + name;
|
||||
String commentKey = langKey + '.' + "comment";
|
||||
String comment = "";
|
||||
if (StatCollector.canTranslate(commentKey)) {
|
||||
comment = StatCollector.translateToLocal(commentKey);
|
||||
}
|
||||
|
||||
Property prop = this.get(category, name, defaultValue);
|
||||
prop.setValidValues(validValues);
|
||||
prop.setLanguageKey(langKey);
|
||||
prop.comment = comment + " [default: " + defaultValue + "] [valid: " + Arrays.toString(prop.getValidValues()) + "]";
|
||||
return prop.getString();
|
||||
}
|
||||
|
||||
public String[] getStringListLocalized(String category, String name, String[] defaultValue) {
|
||||
String langKey = "for.config." + category + '.' + name;
|
||||
String commentKey = langKey + '.' + "comment";
|
||||
String comment = "";
|
||||
if (StatCollector.canTranslate(commentKey)) {
|
||||
comment = StatCollector.translateToLocal(commentKey);
|
||||
}
|
||||
return super.getStringList(name, category, defaultValue, comment);
|
||||
}
|
||||
|
||||
public String[] getStringListLocalized(String category, String name, String[] defaultValue, String[] validValues) {
|
||||
String langKey = "for.config." + category + '.' + name;
|
||||
String commentKey = langKey + '.' + "comment";
|
||||
String comment = "";
|
||||
if (StatCollector.canTranslate(commentKey)) {
|
||||
comment = StatCollector.translateToLocal(commentKey);
|
||||
}
|
||||
|
||||
Property prop = this.get(category, name, defaultValue);
|
||||
prop.setLanguageKey(langKey);
|
||||
prop.setValidValues(validValues);
|
||||
prop.comment = comment + " [default: " + Arrays.toString(defaultValue) + "] [valid: " + Arrays.toString(prop.getValidValues()) + "]";
|
||||
return prop.getStringList();
|
||||
}
|
||||
|
||||
public float getFloatLocalized(String category, String name, float defaultValue, float minValue, float maxValue) {
|
||||
String langKey = "for.config." + category + '.' + name;
|
||||
String commentKey = langKey + '.' + "comment";
|
||||
String comment = "";
|
||||
if (StatCollector.canTranslate(commentKey)) {
|
||||
comment = StatCollector.translateToLocal(commentKey);
|
||||
}
|
||||
return getFloat(name, category, defaultValue, minValue, maxValue, comment, langKey);
|
||||
}
|
||||
|
||||
public int getIntLocalized(String category, String name, int defaultValue, int minValue, int maxValue) {
|
||||
String langKey = "for.config." + category + '.' + name;
|
||||
String commentKey = langKey + '.' + "comment";
|
||||
String comment = "";
|
||||
if (StatCollector.canTranslate(commentKey)) {
|
||||
comment = StatCollector.translateToLocal(commentKey);
|
||||
}
|
||||
return getInt(name, category, defaultValue, minValue, maxValue, comment, langKey);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,7 +36,6 @@ import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
@@ -135,6 +134,7 @@ import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.config.LocalizedConfiguration;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.gadgets.BlockBase;
|
||||
import forestry.core.gadgets.MachineDefinition;
|
||||
@@ -151,6 +151,7 @@ import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.EntitySnowFX;
|
||||
import forestry.core.utils.ShapedRecipeCustom;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
@Plugin(pluginID = "Apiculture", name = "Apiculture", author = "SirSengir", url = Defaults.URL, unlocalizedDescription = "for.plugin.apiculture.description")
|
||||
public class PluginApiculture extends ForestryPlugin {
|
||||
@@ -160,7 +161,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
private static final String CONFIG_CATEGORY = "apiculture";
|
||||
public static final String[] EMPTY_STRINGS = new String[0];
|
||||
public static String beekeepingMode = "NORMAL";
|
||||
private static double secondPrincessChance = 0;
|
||||
private static float secondPrincessChance = 0;
|
||||
public static int ticksPerBeeWorkCycle = 550;
|
||||
public static boolean apiarySideSensitive = false;
|
||||
public static boolean fancyRenderedBees = false;
|
||||
@@ -261,7 +262,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
ApicultureTriggers.initialize();
|
||||
}
|
||||
|
||||
if (Config.enableVillager) {
|
||||
if (Config.enableVillagers) {
|
||||
// Register village components with the Structure registry.
|
||||
VillageHandlerApiculture.registerVillageComponents();
|
||||
}
|
||||
@@ -291,35 +292,29 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
Configuration config = new Configuration(configFile);
|
||||
|
||||
Property property = config.get("apiary", "sidesensitive", apiarySideSensitive);
|
||||
property.comment = "set to false if apiaries should output all items regardless of side a pipe is attached to";
|
||||
apiarySideSensitive = property.getBoolean();
|
||||
|
||||
property = config.get("render.bees", "fancy", fancyRenderedBees);
|
||||
property.comment = "set to true to enable a fancy butterfly-like renderer for bees. (experimental!)";
|
||||
fancyRenderedBees = property.getBoolean();
|
||||
LocalizedConfiguration config = new LocalizedConfiguration(configFile, "1.0.0");
|
||||
|
||||
List<IBeekeepingMode> beekeepingModes = BeeManager.beeRoot.getBeekeepingModes();
|
||||
String[] validBeekeepingModeNames = new String[beekeepingModes.size()];
|
||||
for (int i = 0; i < beekeepingModes.size(); i++) {
|
||||
validBeekeepingModeNames[i] = beekeepingModes.get(i).getName();
|
||||
}
|
||||
property = config.get("beekeeping", "mode", "NORMAL", "Change the beekeeping mode. Accepted values are EASY, NORMAL, HARD, HARDCORE, and INSANE.", validBeekeepingModeNames);
|
||||
beekeepingMode = property.getString();
|
||||
|
||||
beekeepingMode = config.getStringLocalized("beekeeping", "mode", "NORMAL", validBeekeepingModeNames);
|
||||
Proxies.log.finer("Beekeeping mode read from config: " + beekeepingMode);
|
||||
|
||||
property = config.get("beekeeping", "secondPrincess", secondPrincessChance, "percent chance of a second princess drop, for limited/skyblock maps.", 0.0, 100.0);
|
||||
secondPrincessChance = property.getDouble();
|
||||
secondPrincessChance = config.getFloatLocalized("beekeeping", "second.princess", secondPrincessChance, 0.0f, 100.0f);
|
||||
|
||||
String acceptedFlowerMessage = StringUtil.localize("config.beekeeping.flowers.accepted.comment");
|
||||
String plantableFlowerMessage = StringUtil.localize("config.beekeeping.flowers.plantable.comment");
|
||||
|
||||
for (String flowerType : FlowerManager.flowerRegistry.getFlowerTypes()) {
|
||||
String[] defaultAccepted = defaultAcceptedFlowers.get(flowerType);
|
||||
if (defaultAccepted == null) {
|
||||
defaultAccepted = EMPTY_STRINGS;
|
||||
}
|
||||
property = config.get("beekeeping.flowers." + flowerType, "accepted", defaultAccepted);
|
||||
property.comment = "Accepted flowers allow bees to work. Format is 'modid:name:meta', one per line. The format for wildcard metadata is 'modid:name'.";
|
||||
Property property = config.get("beekeeping.flowers." + flowerType, "accepted", defaultAccepted);
|
||||
property.comment = acceptedFlowerMessage;
|
||||
parseAcceptedFlowers(property, flowerType);
|
||||
|
||||
String[] defaultPlantable = defaultPlantableFlowers.get(flowerType);
|
||||
@@ -327,13 +322,12 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
defaultPlantable = EMPTY_STRINGS;
|
||||
}
|
||||
property = config.get("beekeeping.flowers." + flowerType, "plantable", defaultPlantable);
|
||||
property.comment = "Plantable flowers are placed by bees. All plantable flowers are automatically accepted flowers. Format is 'weight:modid:name:meta', one per line. 'weight' is between 0.0 and 1.0. The format for wildcard metadata is 'weight:modid:name'.";
|
||||
property.comment = plantableFlowerMessage;
|
||||
parsePlantableFlowers(property, flowerType);
|
||||
}
|
||||
|
||||
property = config.get("species.blacklist", CONFIG_CATEGORY, EMPTY_STRINGS);
|
||||
property.comment = "add species to blacklist identified by their uid, one per line.";
|
||||
parseBeeBlacklist(property.getStringList());
|
||||
String[] blacklist = config.getStringListLocalized("species", "blacklist", EMPTY_STRINGS);
|
||||
parseBeeBlacklist(blacklist);
|
||||
|
||||
config.save();
|
||||
|
||||
@@ -370,7 +364,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
BeeManager.villageBees[1].add(BeeDefinition.COMMON.getGenome());
|
||||
BeeManager.villageBees[1].add(BeeDefinition.VALIANT.getGenome());
|
||||
|
||||
if (Config.enableVillager) {
|
||||
if (Config.enableVillagers) {
|
||||
// Register villager stuff
|
||||
VillageHandlerApiculture villageHandler = new VillageHandlerApiculture();
|
||||
VillagerRegistry.instance().registerVillageCreationHandler(villageHandler);
|
||||
@@ -465,7 +459,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
beekeepingMode = property.value.trim();
|
||||
Proxies.log.finer("Beekeeping mode read from config: " + beekeepingMode);
|
||||
|
||||
property = apicultureConfig.get("beekeeping.secondprincess", CONFIG_CATEGORY, (float) secondPrincessChance);
|
||||
property = apicultureConfig.get("beekeeping.secondprincess", CONFIG_CATEGORY, secondPrincessChance);
|
||||
property.comment = "percent chance of second princess drop, for limited/skyblock maps. Acceptable values up to 2 decimals.";
|
||||
secondPrincessChance = Float.parseFloat(property.value);
|
||||
|
||||
|
||||
@@ -340,7 +340,7 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandlerArboriculture());
|
||||
|
||||
if (Config.enableVillager) {
|
||||
if (Config.enableVillagers) {
|
||||
VillagerRegistry.instance().registerVillagerId(Defaults.ID_VILLAGER_LUMBERJACK);
|
||||
Proxies.render.registerVillagerSkin(Defaults.ID_VILLAGER_LUMBERJACK, Defaults.TEXTURE_SKIN_LUMBERJACK);
|
||||
VillagerRegistry.instance().registerVillageTradeHandler(Defaults.ID_VILLAGER_LUMBERJACK, new VillageHandlerArboriculture());
|
||||
|
||||
@@ -19,8 +19,6 @@ 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;
|
||||
@@ -40,6 +38,7 @@ import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.config.LocalizedConfiguration;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.gadgets.BlockBase;
|
||||
import forestry.core.gadgets.MachineDefinition;
|
||||
@@ -124,21 +123,7 @@ public class PluginLepidopterology extends ForestryPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
loadNewConfig(configFile);
|
||||
|
||||
PluginCore.rootCommand.addChildCommand(new CommandButterfly());
|
||||
|
||||
@@ -165,7 +150,17 @@ public class PluginLepidopterology extends ForestryPlugin {
|
||||
RecipeSorter.register("forestry:lepidopterologymating", MatingRecipe.class, RecipeSorter.Category.SHAPELESS, "before:minecraft:shapeless");
|
||||
}
|
||||
|
||||
private void loadOldConfig() {
|
||||
private static void loadNewConfig(File configFile) {
|
||||
LocalizedConfiguration config = new LocalizedConfiguration(configFile, "1.0.0");
|
||||
|
||||
spawnConstraint = config.getIntLocalized("butterfly.entities", "spawn.limit", spawnConstraint, 0, 500);
|
||||
entityConstraint = config.getIntLocalized("butterfly.entities", "maximum", entityConstraint, 0, 5000);
|
||||
allowPollination = config.getBooleanLocalized("butterfly.entities", "pollination", allowPollination);
|
||||
|
||||
config.save();
|
||||
}
|
||||
|
||||
private static 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);
|
||||
|
||||
@@ -131,9 +131,12 @@ public class PluginMail extends ForestryPlugin {
|
||||
protected void registerItems() {
|
||||
|
||||
stampDefinitions = new StampInfo[]{
|
||||
new StampInfo("1n", EnumPostage.P_1, ForestryItem.apatite, 0x4a8ca7, 0xffffff), new StampInfo("2n", EnumPostage.P_2, "ingotCopper", 0xe8c814, 0xffffff),
|
||||
new StampInfo("5n", EnumPostage.P_5, "ingotTin", 0x9c0707, 0xffffff), new StampInfo("10n", EnumPostage.P_10, Items.gold_ingot, 0x7bd1b8, 0xffffff),
|
||||
new StampInfo("20n", EnumPostage.P_20, Items.diamond, 0xff9031, 0xfff7dd), new StampInfo("50n", EnumPostage.P_50, Items.emerald, 0x6431d7, 0xfff7dd),
|
||||
new StampInfo("1n", EnumPostage.P_1, ForestryItem.apatite, 0x4a8ca7, 0xffffff),
|
||||
new StampInfo("2n", EnumPostage.P_2, "ingotCopper", 0xe8c814, 0xffffff),
|
||||
new StampInfo("5n", EnumPostage.P_5, "ingotTin", 0x9c0707, 0xffffff),
|
||||
new StampInfo("10n", EnumPostage.P_10, Items.gold_ingot, 0x7bd1b8, 0xffffff),
|
||||
new StampInfo("20n", EnumPostage.P_20, Items.diamond, 0xff9031, 0xfff7dd),
|
||||
new StampInfo("50n", EnumPostage.P_50, Items.emerald, 0x6431d7, 0xfff7dd),
|
||||
new StampInfo("100n", EnumPostage.P_100, Items.nether_star, 0xd731ba, 0xfff7dd)}; //new StampInfo("200n", EnumPostage.P_200, Item.netherStar, 0xcd9831, 0xfff7dd)};
|
||||
|
||||
/* STAMPS */
|
||||
|
||||
@@ -43,7 +43,6 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
@@ -61,6 +60,7 @@ import forestry.api.storage.StorageManager;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.config.LocalizedConfiguration;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.interfaces.IPickupHandler;
|
||||
import forestry.core.interfaces.IResupplyHandler;
|
||||
@@ -68,6 +68,7 @@ import forestry.core.items.ItemCrated;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.factory.gadgets.MachineCarpenter;
|
||||
import forestry.storage.BackpackDefinition;
|
||||
import forestry.storage.BackpackHelper;
|
||||
@@ -165,7 +166,7 @@ public class PluginStorage extends ForestryPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
Configuration config = new Configuration(configFile);
|
||||
LocalizedConfiguration config = new LocalizedConfiguration(configFile, "1.0.0");
|
||||
|
||||
handleBackpackConfig(config, "miner");
|
||||
handleBackpackConfig(config, "digger");
|
||||
@@ -413,7 +414,7 @@ public class PluginStorage extends ForestryPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
private static void handleBackpackConfig(Configuration config, String backpackName) {
|
||||
private static void handleBackpackConfig(LocalizedConfiguration config, String backpackName) {
|
||||
BackpackDefinition backpackDefinition = (BackpackDefinition) BackpackManager.definitions.get(backpackName);
|
||||
|
||||
List<ItemStack> backpackItems;
|
||||
@@ -424,8 +425,8 @@ public class PluginStorage extends ForestryPlugin {
|
||||
Collections.sort(validItems);
|
||||
String[] defaultValidItems = validItems.toArray(new String[validItems.size()]);
|
||||
|
||||
Property backpackConf = config.get("backpacks." + backpackName, "itemStacks", defaultValidItems);
|
||||
backpackConf.comment = "Add itemStacks for the " + backpackName + "'s backpack here in the format 'modid:name:meta'. For wildcard metadata the format is 'modid:name'.";
|
||||
Property backpackConf = config.get("backpacks." + backpackName, "item.stacks", defaultValidItems);
|
||||
backpackConf.comment = StringUtil.localizeAndFormat("config.backpacks.item.stacks.format", backpackName);
|
||||
|
||||
String[] backpackItemList = backpackConf.getStringList();
|
||||
backpackItems = StackUtils.parseItemStackStrings(backpackItemList, OreDictionary.WILDCARD_VALUE);
|
||||
@@ -444,8 +445,8 @@ public class PluginStorage extends ForestryPlugin {
|
||||
Collections.sort(defaultOreNamesList);
|
||||
defaultOreNames = defaultOreNamesList.toArray(new String[defaultOreNamesList.size()]);
|
||||
|
||||
Property backpackConf = config.get("backpacks." + backpackName, "oreDict", defaultOreNames);
|
||||
backpackConf.comment = "Add ore dictionary names for the " + backpackName + "'s backpack here in the format 'oreDictName'.";
|
||||
Property backpackConf = config.get("backpacks." + backpackName, "ore.dict", defaultOreNames);
|
||||
backpackConf.comment = StringUtil.localizeAndFormat("config.backpacks.ore.dict.format", backpackName);
|
||||
|
||||
String[] oreDictNameList = backpackConf.getStringList();
|
||||
Collections.addAll(backpackOreDict, oreDictNameList);
|
||||
|
||||
Reference in new issue
Block a user