use of forestry.core.config.LocalizedConfiguration in project ForestryMC by ForestryMC.
the class ModuleLepidopterology method loadConfig.
private static void loadConfig(File configFile) {
LocalizedConfiguration config = new LocalizedConfiguration(configFile, "1.1.0");
spawnConstraint = config.getIntLocalized("butterfly.entities", "spawn.limit", spawnConstraint, 0, 500);
entityConstraint = config.getIntLocalized("butterfly.entities", "maximum", entityConstraint, 0, 5000);
maxDistance = config.getIntLocalized("butterfly.entities", "maxDistance", maxDistance, 0, 256);
allowPollination = config.getBooleanLocalized("butterfly.entities", "pollination", allowPollination);
spawnButterflysFromLeaves = config.getBooleanLocalized("butterfly.entities", "spawn.leaves", spawnButterflysFromLeaves);
generateCocoons = config.getBooleanLocalized("butterfly.cocoons", "generate", generateCocoons);
generateCocoonsAmount = config.getFloatLocalized("butterfly.cocoons", "generate.amount", generateCocoonsAmount, 0.0f, 10.0f);
serumChance = config.getFloatLocalized("butterfly.cocoons", "serum", serumChance, 0.0f, 100.0f);
secondSerumChance = config.getFloatLocalized("butterfly.cocoons", "second.serum", secondSerumChance, 0.0f, 100.0f);
parseRarity(config);
parseCooconLoots(config);
config.save();
}
use of forestry.core.config.LocalizedConfiguration in project ForestryMC by ForestryMC.
the class ModuleFarming method doInit.
@Override
public void doInit() {
// Load config
File configFile = new File(Forestry.instance.getConfigFolder(), Config.CATEGORY_FARM + ".cfg");
LocalizedConfiguration config = new LocalizedConfiguration(configFile, "1.0.0");
FarmRegistry.getInstance().loadConfig(config);
config.save();
GameRegistry.registerTileEntity(TileFarmPlain.class, "forestry.Farm");
GameRegistry.registerTileEntity(TileFarmGearbox.class, "forestry.FarmGearbox");
GameRegistry.registerTileEntity(TileFarmHatch.class, "forestry.FarmHatch");
GameRegistry.registerTileEntity(TileFarmValve.class, "forestry.FarmValve");
GameRegistry.registerTileEntity(TileFarmControl.class, "forestry.FarmControl");
IFarmRegistry registry = FarmRegistry.getInstance();
BlockRegistryCore coreBlocks = ModuleCore.getBlocks();
IFarmProperties arborealFarm = registry.registerLogic("farmArboreal", FarmLogicArboreal::new);
IFarmProperties cropsFarm = registry.registerLogic("farmCrops", FarmLogicCrops::new);
IFarmProperties mushroomFarm = registry.registerLogic("farmShroom", FarmLogicMushroom::new);
IFarmProperties succulentFarm = registry.registerLogic("farmSucculentes", FarmLogicSucculent::new);
IFarmProperties peatFarm = registry.registerLogic("farmPeat", FarmLogicPeat::new);
IFarmProperties infernalFarm = registry.registerLogic("farmInfernal", FarmLogicInfernal::new);
IFarmProperties poalesFarm = registry.registerLogic("farmPoales", FarmLogicReeds::new);
IFarmProperties orchardFarm = registry.registerLogic("farmOrchard", FarmLogicOrchard::new);
IFarmProperties gourdFarm = registry.registerLogic("farmGourd", FarmLogicGourd::new);
IFarmProperties cocoaFarm = registry.registerLogic("farmCocoa", FarmLogicCocoa::new);
IFarmProperties enderFarm = registry.registerLogic("farmEnder", FarmLogicEnder::new);
Circuits.farmArborealManaged = new CircuitFarmLogic("managedArboreal", arborealFarm, false);
Circuits.farmArborealManual = new CircuitFarmLogic("manualArboreal", arborealFarm, true);
arborealFarm.registerSoil(new ItemStack(Blocks.DIRT), coreBlocks.humus.getDefaultState());
arborealFarm.registerSoil(new ItemStack(coreBlocks.humus), coreBlocks.humus.getDefaultState());
Circuits.farmShroomManaged = new CircuitFarmLogic("managedShroom", mushroomFarm, false);
Circuits.farmShroomManual = new CircuitFarmLogic("manualShroom", mushroomFarm, true);
mushroomFarm.registerSoil(new ItemStack(Blocks.MYCELIUM), Blocks.MYCELIUM.getDefaultState());
mushroomFarm.registerSoil(new ItemStack(Blocks.DIRT, 1, 2), Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.PODZOL), true);
Circuits.farmPeatManaged = new CircuitFarmLogic("managedPeat", peatFarm, false);
Circuits.farmPeatManual = new CircuitFarmLogic("manualPeat", peatFarm, true);
peatFarm.registerSoil(coreBlocks.bogEarth.get(BlockBogEarth.SoilType.BOG_EARTH, 1), coreBlocks.bogEarth.getDefaultState());
Circuits.farmCropsManaged = new CircuitFarmLogic("managedCrops", cropsFarm, false);
Circuits.farmCropsManual = new CircuitFarmLogic("manualCrops", cropsFarm, true);
cropsFarm.registerSoil(new ItemStack(Blocks.DIRT), Blocks.FARMLAND.getDefaultState());
cocoaFarm.registerFarmables("farmWheat");
Circuits.farmInfernalManaged = new CircuitFarmLogic("managedInfernal", infernalFarm, false);
Circuits.farmInfernalManual = new CircuitFarmLogic("manualInfernal", infernalFarm, true);
infernalFarm.registerSoil(new ItemStack(Blocks.SOUL_SAND), Blocks.SOUL_SAND.getDefaultState());
Circuits.farmOrchardManaged = new CircuitFarmLogic("managedOrchard", orchardFarm, false);
Circuits.farmOrchardManual = new CircuitFarmLogic("manualOrchard", orchardFarm, true);
Circuits.farmSucculentManaged = new CircuitFarmLogic("managedSucculent", succulentFarm, false);
Circuits.farmSucculentManual = new CircuitFarmLogic("manualSucculent", succulentFarm, true);
succulentFarm.registerSoil(new ItemStack(Blocks.SAND), Blocks.SAND.getDefaultState(), true);
Circuits.farmPoalesManaged = new CircuitFarmLogic("managedPoales", poalesFarm, false);
Circuits.farmPoalesManual = new CircuitFarmLogic("manualPoales", poalesFarm, true);
poalesFarm.registerSoil(new ItemStack(Blocks.SAND), Blocks.SAND.getDefaultState(), true);
poalesFarm.registerSoil(new ItemStack(Blocks.DIRT), Blocks.DIRT.getDefaultState(), false);
Circuits.farmGourdManaged = new CircuitFarmLogic("managedGourd", gourdFarm, false);
Circuits.farmGourdManual = new CircuitFarmLogic("manualGourd", gourdFarm, true);
Circuits.farmCocoaManaged = new CircuitFarmLogic("managedCocoa", cocoaFarm, false);
Circuits.farmCocoaManual = new CircuitFarmLogic("manualCocoa", cocoaFarm, true);
Circuits.farmEnderManaged = new CircuitFarmLogic("managedEnder", enderFarm, false);
Circuits.farmEnderManual = new CircuitFarmLogic("manualEnder", enderFarm, true);
enderFarm.registerSoil(new ItemStack(Blocks.END_STONE), Blocks.END_STONE.getDefaultState());
}
use of forestry.core.config.LocalizedConfiguration in project ForestryMC by ForestryMC.
the class ModuleBackpacks method postInit.
@Override
public void postInit() {
final String newConfig = CONFIG_CATEGORY + ".cfg";
File configFile = new File(Forestry.instance.getConfigFolder(), newConfig);
LocalizedConfiguration config = new LocalizedConfiguration(configFile, "2.0.0");
if (!config.getDefinedConfigVersion().equals(config.getLoadedConfigVersion())) {
boolean deleted = configFile.delete();
if (deleted) {
config = new LocalizedConfiguration(configFile, "2.0.0");
}
}
setDefaultsForConfig();
for (String backpackUid : forestryBackpackUids) {
handleBackpackConfig(config, backpackUid);
}
config.save();
}
use of forestry.core.config.LocalizedConfiguration in project ForestryMC by ForestryMC.
the class ModuleApiculture method doInit.
// TODO: Buildcraft for 1.9
// @Override
// public void registerTriggers() {
// ApicultureTriggers.initialize();
// }
@Override
public void doInit() {
File configFile = new File(Forestry.instance.getConfigFolder(), CONFIG_CATEGORY + ".cfg");
LocalizedConfiguration config = new LocalizedConfiguration(configFile, "3.0.0");
if (!Objects.equals(config.getLoadedConfigVersion(), config.getDefinedConfigVersion())) {
boolean deleted = configFile.delete();
if (deleted) {
config = new LocalizedConfiguration(configFile, "3.0.0");
}
}
initFlowerRegistry();
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();
}
beekeepingMode = config.getStringLocalized("beekeeping", "mode", "NORMAL", validBeekeepingModeNames);
Log.debug("Beekeeping mode read from config: " + beekeepingMode);
secondPrincessChance = config.getFloatLocalized("beekeeping", "second.princess", secondPrincessChance, 0.0f, 100.0f);
maxFlowersSpawnedPerHive = config.getIntLocalized("beekeeping", "flowers.spawn", 20, 0, 1000);
String[] blacklist = config.getStringListLocalized("species", "blacklist", Constants.EMPTY_STRINGS);
parseBeeBlacklist(blacklist);
ticksPerBeeWorkCycle = config.getIntLocalized("beekeeping", "ticks.work", 550, 250, 850);
hivesDamageOnPeaceful = config.getBooleanLocalized("beekeeping", "hivedamage.peaceful", false);
doSelfPollination = config.getBooleanLocalized("beekeeping", "self.pollination", false);
config.save();
// Genetics
createAlleles();
BeeDefinition.initBees();
// Hives
createHives();
registerBeehiveDrops();
ItemRegistryApiculture items = getItems();
BlockRegistryApiculture blocks = getBlocks();
// Inducers for swarmer
BeeManager.inducers.put(items.royalJelly.getItemStack(), 10);
GameRegistry.registerTileEntity(TileAlvearyPlain.class, "forestry.Alveary");
GameRegistry.registerTileEntity(TileHive.class, "forestry.Swarm");
GameRegistry.registerTileEntity(TileAlvearySwarmer.class, "forestry.AlvearySwarmer");
GameRegistry.registerTileEntity(TileAlvearyHeater.class, "forestry.AlvearyHeater");
GameRegistry.registerTileEntity(TileAlvearyFan.class, "forestry.AlvearyFan");
GameRegistry.registerTileEntity(TileAlvearyHygroregulator.class, "forestry.AlvearyHygro");
GameRegistry.registerTileEntity(TileAlvearyStabiliser.class, "forestry.AlvearyStabiliser");
GameRegistry.registerTileEntity(TileAlvearySieve.class, "forestry.AlvearySieve");
GameRegistry.registerTileEntity(TileCandle.class, "forestry.Candle");
ResourceLocation beeHouseCartResource = new ResourceLocation(Constants.MOD_ID, "cart.beehouse");
EntityUtil.registerEntity(beeHouseCartResource, EntityMinecartBeehouse.class, "cart.beehouse", 1, 0x000000, 0xffffff, 256, 3, true);
ResourceLocation apiaryCartResource = new ResourceLocation(Constants.MOD_ID, "cart.apiary");
EntityUtil.registerEntity(apiaryCartResource, EntityMinecartApiary.class, "cart.apiary", 2, 0x000000, 0xffffff, 256, 3, true);
BeeManager.commonVillageBees.add(BeeDefinition.FOREST.getGenome());
BeeManager.commonVillageBees.add(BeeDefinition.MEADOWS.getGenome());
BeeManager.commonVillageBees.add(BeeDefinition.MODEST.getGenome());
BeeManager.commonVillageBees.add(BeeDefinition.MARSHY.getGenome());
BeeManager.commonVillageBees.add(BeeDefinition.WINTRY.getGenome());
BeeManager.commonVillageBees.add(BeeDefinition.TROPICAL.getGenome());
BeeManager.uncommonVillageBees.add(BeeDefinition.FOREST.getRainResist().getGenome());
BeeManager.uncommonVillageBees.add(BeeDefinition.COMMON.getGenome());
BeeManager.uncommonVillageBees.add(BeeDefinition.VALIANT.getGenome());
if (Config.enableVillagers) {
// Register villager stuff
VillageCreationApiculture villageHandler = new VillageCreationApiculture();
VillagerRegistry villagerRegistry = VillagerRegistry.instance();
villagerRegistry.registerVillageCreationHandler(villageHandler);
villagerApiarist = new VillagerRegistry.VillagerProfession(Constants.ID_VILLAGER_APIARIST, Constants.TEXTURE_SKIN_BEEKPEEPER, Constants.TEXTURE_SKIN_ZOMBIE_BEEKPEEPER);
IForgeRegistry<VillagerRegistry.VillagerProfession> villagerProfessions = ForgeRegistries.VILLAGER_PROFESSIONS;
villagerProfessions.register(villagerApiarist);
ItemStack wildcardPrincess = new ItemStack(items.beePrincessGE, 1);
ItemStack wildcardDrone = new ItemStack(items.beeDroneGE, 1);
ItemStack apiary = new ItemStack(blocks.apiary);
ItemStack provenFrames = items.frameProven.getItemStack();
ItemStack monasticDrone = BeeDefinition.MONASTIC.getMemberStack(EnumBeeType.DRONE);
ItemStack endDrone = BeeDefinition.ENDED.getMemberStack(EnumBeeType.DRONE);
ItemStack propolis = new ItemStack(items.propolis, 1);
VillagerRegistry.VillagerCareer apiaristCareer = new VillagerRegistry.VillagerCareer(villagerApiarist, "apiarist");
apiaristCareer.addTrade(1, new VillagerApiaristTrades.GiveRandomCombsForItems(items.beeComb, new ItemStack(Items.WHEAT), new EntityVillager.PriceInfo(8, 12), new EntityVillager.PriceInfo(2, 4)), new VillagerApiaristTrades.GiveRandomCombsForItems(items.beeComb, new ItemStack(Items.CARROT), new EntityVillager.PriceInfo(8, 12), new EntityVillager.PriceInfo(2, 4)), new VillagerApiaristTrades.GiveRandomCombsForItems(items.beeComb, new ItemStack(Items.POTATO), new EntityVillager.PriceInfo(8, 12), new EntityVillager.PriceInfo(2, 4)));
apiaristCareer.addTrade(2, new VillagerTradeLists.GiveItemForEmeralds(new EntityVillager.PriceInfo(1, 4), new ItemStack(items.smoker), null), new VillagerTradeLists.GiveItemForLogsAndEmeralds(apiary, new EntityVillager.PriceInfo(1, 1), new EntityVillager.PriceInfo(16, 32), new EntityVillager.PriceInfo(1, 2)), new VillagerApiaristTrades.GiveRandomHiveDroneForItems(propolis, null, wildcardDrone, new EntityVillager.PriceInfo(2, 4)));
apiaristCareer.addTrade(3, new VillagerTradeLists.GiveEmeraldForItems(wildcardPrincess, null), new VillagerTradeLists.GiveItemForEmeralds(new EntityVillager.PriceInfo(1, 2), provenFrames, new EntityVillager.PriceInfo(1, 6)));
apiaristCareer.addTrade(4, new VillagerTradeLists.GiveItemForItemAndEmerald(wildcardPrincess, null, new EntityVillager.PriceInfo(10, 64), monasticDrone, null), new VillagerTradeLists.GiveItemForTwoItems(wildcardPrincess, null, new ItemStack(Items.ENDER_EYE), new EntityVillager.PriceInfo(12, 16), endDrone, null));
}
blocks.apiary.init();
blocks.beeHouse.init();
blocks.beeChest.init();
}
Aggregations