Java Code Examples for cpw.mods.fml.common.event.FMLPreInitializationEvent#getSuggestedConfigurationFile()
The following examples show how to use
cpw.mods.fml.common.event.FMLPreInitializationEvent#getSuggestedConfigurationFile() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Chisel.java From Chisel-2 with GNU General Public License v2.0 | 6 votes |
@EventHandler public void preInit(FMLPreInitializationEvent event) { File configFile = event.getSuggestedConfigurationFile(); Configurations.configExists = configFile.exists(); Configurations.config = new Configuration(configFile); Configurations.config.load(); Configurations.refreshConfig(); ChiselTabs.preInit(); Features.preInit(); Statistics.init(); PacketHandler.init(); ChiselController.INSTANCE.preInit(); if (Loader.isModLoaded("ForgeMultipart")) { new FMPCompat().init(); } proxy.preInit(); }
Example 2
Source File: OpenPeripheralCore.java From OpenPeripheral with MIT License | 6 votes |
@Mod.EventHandler public void preInit(FMLPreInitializationEvent evt) { apiSetup.installHolderAccess(evt.getAsmData()); PeripheralTypeProvider.INSTANCE.initialize(evt.getModConfigurationDirectory()); final File configFile = evt.getSuggestedConfigurationFile(); config = new Configuration(configFile); ConfigProcessing.processAnnotations(ModInfo.ID, config, Config.class); if (config.hasChanged()) config.save(); FeatureGroupManager.INSTANCE.loadBlacklist(Config.featureGroupsBlacklist); FMLCommonHandler.instance().bus().register(new ConfigGuiFactory.ConfigChangeListener(config)); MinecraftForge.EVENT_BUS.register(TileEntityBlacklist.INSTANCE); FMLInterModComms.sendMessage(Mods.OPENCOMPUTERS, "blacklistPeripheral", IOpenPeripheral.class.getName()); TypeClassifier.INSTANCE.registerClassifier(new MinecraftTypeClassifier()); FeatureGroupManager.INSTANCE.loadFeatureGroupsFromAnnotations(evt.getAsmData()); }
Example 3
Source File: NBTEdit.java From NBTEdit with GNU General Public License v3.0 | 5 votes |
@EventHandler public void preInit(FMLPreInitializationEvent event){ ModMetadata modMeta = event.getModMetadata(); modMeta.authorList = Arrays.asList(new String[] { "Davidee" }); modMeta.autogenerated = false; modMeta.credits = "Thanks to Mojang, Forge, and all your support."; modMeta.description = "Allows you to edit NBT Tags in-game.\nPlease visit the URL above for help."; modMeta.url = "http://www.minecraftforum.net/topic/1558668-151/"; Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); opOnly = config.get("General", "opOnly", true, "true if only Ops can NBTEdit; false allows users in creative mode to NBTEdit").getBoolean(true); config.save(); }
Example 4
Source File: MoCProxy.java From mocreaturesdev with GNU General Public License v3.0 | 5 votes |
public void ConfigInit(FMLPreInitializationEvent event) { configPreEvent = event; MoCconfig = new MoCConfiguration(new File(event.getSuggestedConfigurationFile().getParent(), "MoCProperties.cfg")); MoCBiomeConfig = new MoCConfiguration(new File(event.getSuggestedConfigurationFile().getParent(), "MoCBiomeGroups.cfg")); configFile = event.getSuggestedConfigurationFile(); MoCconfig.load(); MoCBiomeConfig.load(); this.readConfigValues(); if (debugLogging) MoCreatures.log.info("Initializing MoCreatures Server Config File at " + event.getSuggestedConfigurationFile().getParent() + "MoCProperties.cfg"); }
Example 5
Source File: HexxitGearConfig.java From HexxitGear with GNU General Public License v3.0 | 5 votes |
public static void loadCommonConfig(FMLPreInitializationEvent evt) { Configuration c = new Configuration(evt.getSuggestedConfigurationFile()); try { c.load(); hexbiscus = c.getBlock("ID.HexbiscusFlower", 2400); tribalHelmetId = c.getItem(Configuration.CATEGORY_ITEM, "ID.TribalHelmet", 26200); tribalChestId = c.getItem(Configuration.CATEGORY_ITEM, "ID.TribalChest", 26201); tribalLeggingsId = c.getItem(Configuration.CATEGORY_ITEM, "ID.TribalLeggings", 26202); tribalShoesId = c.getItem(Configuration.CATEGORY_ITEM, "ID.TribalShoes", 26203); scaleHelmetId = c.getItem(Configuration.CATEGORY_ITEM, "ID.ScaleHelmet", 26204); scaleChestId = c.getItem(Configuration.CATEGORY_ITEM, "ID.ScaleChest", 26205); scaleLeggingsId = c.getItem(Configuration.CATEGORY_ITEM, "ID.ScaleLeggings", 26206); scaleBootsId = c.getItem(Configuration.CATEGORY_ITEM, "ID.ScaleBoots", 26207); thiefHelmetId = c.getItem(Configuration.CATEGORY_ITEM, "ID.ThiefHelmet", 26208); thiefChestId = c.getItem(Configuration.CATEGORY_ITEM, "ID.ThiefChest", 26209); thiefLeggingsId = c.getItem(Configuration.CATEGORY_ITEM, "ID.ThiefLeggings", 26210); thiefBootsId = c.getItem(Configuration.CATEGORY_ITEM, "ID.ThiefBoots", 26211); hexicalEssence = c.getItem(Configuration.CATEGORY_ITEM, "ID.HexicalEssence", 26212); hexicalDiamond = c.getItem(Configuration.CATEGORY_ITEM, "ID.HexicalDiamond", 26213); dimensionalBlacklist = c.get("World Generation", "Dimensional Blacklist", ""); dimensionalBlacklist.comment = "Comma separated list of all blacklisted dimension IDs"; } catch (Exception e) { e.printStackTrace(); } finally { c.save(); } }
Example 6
Source File: TickDynamicMod.java From TickDynamic with MIT License | 4 votes |
@Subscribe public void preInit(FMLPreInitializationEvent event) { config = new Configuration(event.getSuggestedConfigurationFile()); }
Example 7
Source File: QCraft.java From qcraft-mod with Apache License 2.0 | 4 votes |
@Mod.EventHandler public void preInit( FMLPreInitializationEvent event ) { // Load config Configuration config = new Configuration( event.getSuggestedConfigurationFile() ); config.load(); // Setup general Property prop = config.get( Configuration.CATEGORY_GENERAL, "enableQBlockOcclusionTesting", enableQBlockOcclusionTesting ); prop.comment = "Set whether QBlocks should not be observed if their line of sight to the player is obstructed. WARNING: This has a very high performance cost if you have lots of QBlocks in your world!!"; enableQBlockOcclusionTesting = prop.getBoolean( enableQBlockOcclusionTesting ); prop = config.get( Configuration.CATEGORY_GENERAL, "enableWorldGen", enableWorldGen ); prop.comment = "Set whether Quantum Ore will spawn in new chunks"; enableWorldGen = prop.getBoolean( enableWorldGen ); prop = config.get( Configuration.CATEGORY_GENERAL, "enableWorldGenReplacementRecipes", enableWorldGenReplacementRecipes ); prop.comment = "Set whether Quantum Dust can be crafted instead of mined"; enableWorldGenReplacementRecipes = prop.getBoolean( enableWorldGenReplacementRecipes ); prop = config.get( Configuration.CATEGORY_GENERAL, "letAdminsCreatePortals", letAdminsCreatePortals ); prop.comment = "Set whether server admins can energize portals"; letAdminsCreatePortals = prop.getBoolean( letAdminsCreatePortals ); prop = config.get( Configuration.CATEGORY_GENERAL, "letPlayersCreatePortals", letPlayersCreatePortals ); prop.comment = "Set whether players can energize portals."; letPlayersCreatePortals = prop.getBoolean( letPlayersCreatePortals ); prop = config.get( Configuration.CATEGORY_GENERAL, "letAdminsEditPortalServerList", letAdminsEditPortalServerList ); prop.comment = "Set whether server admins can edit the list of Servers which portals can teleport to"; letAdminsEditPortalServerList = prop.getBoolean( letAdminsEditPortalServerList ); prop = config.get( Configuration.CATEGORY_GENERAL, "letPlayersEditPortalServerList", letPlayersEditPortalServerList ); prop.comment = "Set whether players can edit the list of Servers which portals can teleport to"; letPlayersEditPortalServerList = prop.getBoolean( letPlayersEditPortalServerList ); prop = config.get( Configuration.CATEGORY_GENERAL, "letAdminsVerifyPortalServers", letAdminsVerifyPortalServers ); prop.comment = "Set whether server admins can verify an inter-server portal link"; letAdminsVerifyPortalServers = prop.getBoolean( letAdminsVerifyPortalServers ); prop = config.get( Configuration.CATEGORY_GENERAL, "letPlayersVerifyPortalServers", letPlayersVerifyPortalServers ); prop.comment = "Set whether players can verify an inter-server portal link"; letPlayersVerifyPortalServers = prop.getBoolean( letPlayersVerifyPortalServers ); prop = config.get( Configuration.CATEGORY_GENERAL, "maxPortalSize", maxPortalSize ); prop.comment = "Set the maximum height and width for the Quantum Portal inside the frame in blocks. [min: 3, max: 16, def: 5]"; int temp = prop.getInt( maxPortalSize ); if (temp < 3) { maxPortalSize = 3; } else if (temp > 16) { maxPortalSize = 16; } else { maxPortalSize = prop.getInt( maxPortalSize ); } prop.set(maxPortalSize); prop = config.get( Configuration.CATEGORY_GENERAL, "maxQTPSize", maxQTPSize ); prop.comment = "Set the maximum distance from the Quantum Computer that the quantization or teleportation field can extend in blocks. (3 means that there are 2 blocks between the computer and the pillar) [min: 1, max: 16, def: 8]"; temp = prop.getInt( maxQTPSize ); if (temp < 1) { maxQTPSize = 1; } else if (temp > 16) { maxQTPSize = 16; } else { maxQTPSize = prop.getInt( maxQTPSize ); } prop.set(maxQTPSize); //if more configs like these last two get added, it might be a good idea to include a method that checks the maximum and minimum instead of copying code over and over // None // Save config config.save(); // Setup network networkEventChannel = NetworkRegistry.INSTANCE.newEventDrivenChannel( "qCraft" ); networkEventChannel.register( new PacketHandler() ); proxy.preLoad(); }
Example 8
Source File: OpenPeripheralIntegration.java From OpenPeripheral-Integration with MIT License | 4 votes |
@EventHandler public void preInit(FMLPreInitializationEvent evt) { config = new Configuration(evt.getSuggestedConfigurationFile()); if (config.hasCategory("integration")) { ConfigCategory integration = config.getCategory("integration"); config.removeCategory(integration); } if (checkConfig(config, "vanilla")) Integration.addModule(new ModuleVanilla()); if (checkConfig(config, "vanilla-inventory")) Integration.addModule(new ModuleVanillaInventory()); if (checkConfig(config, "vanilla-inventory-manipulation")) Integration.addModule(new ModuleVanillaInventoryManipulation()); if (checkConfig(config, "cofh-api-energy")) Integration.addModule(new ModuleCofhEnergy()); if (checkConfig(config, "cofh-api-inventory")) Integration.addModule(new ModuleCofhInventory()); if (checkConfig(config, "cofh-api-item")) Integration.addModule(new ModuleCofhItem()); if (checkConfig(config, "cofh-api-tileentity")) Integration.addModule(new ModuleCofhTileEntity()); if (checkConfig(config, "cofh-api-transport")) Integration.addModule(new ModuleCofhTransport()); if (checkConfig(config, "buildcraft-api-transport")) Integration.addModule(new ModuleBuildCraftTransport()); if (checkConfig(config, "buildcraft-api-tilenentity")) Integration.addModule(new ModuleBuildCraftTile()); if (checkConfig(config, "buildcraft-api-facades")) Integration.addModule(new ModuleBuildCraftFacades()); if (checkConfig(config, "ic2-mod")) Integration.addModule(new ModuleIC2()); if (checkConfig(config, "ic2-api")) Integration.addModule(new ModuleIC2Api()); if (checkConfig(config, "railcraft-mod")) Integration.addModule(new ModuleRailcraft()); if (checkConfig(config, "railcraft-api-carts")) Integration.addModule(new ModuleRailcraftCarts()); if (checkConfig(config, "railcraft-api-fuel")) Integration.addModule(new ModuleRailcraftFuel()); if (checkConfig(config, "thaumcraft-mod")) Integration.addModule(new ModuleThaumcraft()); if (checkConfig(config, "thaumcraft-api")) Integration.addModule(new ModuleThaumcraftApi()); if (checkConfig(config, "mfr-mod")) Integration.addModule(new ModuleMinefactoryReloaded()); if (checkConfig(config, "mfr-mod-storage")) Integration.addModule(new ModuleMinefactoryReloadedStorage()); if (checkConfig(config, "computercraft-mod")) Integration.addModule(new ModuleComputerCraft()); if (checkConfig(config, "enderstorage-mod")) Integration.addModule(new ModuleEnderStorage()); if (checkConfig(config, "forestry-mod")) Integration.addModule(new ModuleForestry()); if (checkConfig(config, "mystcraft-mod")) { if (sameOrNewerVersion(Mods.MYSTCRAFT, "0.11.1.00")) { if (sameOrNewerVersion(Mods.MYSTCRAFT, "0.11.6.02")) { FMLInterModComms.sendMessage(Mods.MYSTCRAFT, "API", "openperipheral.integration.mystcraft.v2.MystcraftAccess.init"); Integration.addModule(new ModuleMystcraftV2()); } else { Log.warn("Unsupported Mystcraft version!"); } } else { Log.warn("Using old Mystcraft integration, things may explode"); Integration.addModule(new ModuleMystcraftV1()); } } if (checkConfig(config, "thaumcraft-mod")) Integration.addModule(new ModuleThaumcraft()); if (checkConfig(config, "tmechworks-mod")) Integration.addModule(new ModuleTMechworks()); if (checkConfig(config, "thermalexpansion-mod")) Integration.addModule(new ModuleThermalExpansion()); if (checkConfig(config, "ae2-mod")) Integration.addModule(new ModuleAppEng()); ConfigProcessing.processAnnotations(MOD_ID, config, Config.class); FMLCommonHandler.instance().bus().register(new ConfigChangeListener(MOD_ID, config)); if (config.hasChanged()) config.save(); }
Example 9
Source File: ArchimedesShipMod.java From archimedes-ships with MIT License | 4 votes |
@EventHandler public void preInitMod(FMLPreInitializationEvent event) { modLog = event.getModLog(); /*MaterialMap.registerMaterial("air", Material.air); MaterialMap.registerMaterial("anvil", Material.anvil); MaterialMap.registerMaterial("cactus", Material.cactus); MaterialMap.registerMaterial("cake", Material.cake); MaterialMap.registerMaterial("carpet", Material.carpet); MaterialMap.registerMaterial("circuits", Material.circuits); MaterialMap.registerMaterial("clay", Material.clay); MaterialMap.registerMaterial("cloth", Material.cloth); MaterialMap.registerMaterial("coral", Material.coral); MaterialMap.registerMaterial("dragon_egg", Material.dragonEgg); MaterialMap.registerMaterial("fire", Material.fire); MaterialMap.registerMaterial("glass", Material.glass); MaterialMap.registerMaterial("gourd", Material.gourd); MaterialMap.registerMaterial("grass", Material.grass); MaterialMap.registerMaterial("ground", Material.ground); MaterialMap.registerMaterial("ice", Material.ice); MaterialMap.registerMaterial("ice_packed", Material.packedIce); MaterialMap.registerMaterial("iron", Material.iron); MaterialMap.registerMaterial("lava", Material.lava); MaterialMap.registerMaterial("leaves", Material.leaves); MaterialMap.registerMaterial("piston", Material.piston); MaterialMap.registerMaterial("plants", Material.plants); MaterialMap.registerMaterial("portal", Material.portal); MaterialMap.registerMaterial("redstone_light", Material.redstoneLight); MaterialMap.registerMaterial("rock", Material.rock); MaterialMap.registerMaterial("sand", Material.sand); MaterialMap.registerMaterial("snow", Material.snow); MaterialMap.registerMaterial("snow_crafted", Material.craftedSnow); MaterialMap.registerMaterial("sponge", Material.sponge); MaterialMap.registerMaterial("tnt", Material.tnt); MaterialMap.registerMaterial("vine", Material.vine); MaterialMap.registerMaterial("water", Material.water); MaterialMap.registerMaterial("web", Material.web); MaterialMap.registerMaterial("wood", Material.wood);*/ modConfig = new ArchimedesConfig(new Configuration(event.getSuggestedConfigurationFile())); modConfig.loadAndSave(); metaRotations.setConfigDirectory(event.getModConfigurationDirectory()); pipeline.initalize(); createBlocksAndItems(); modConfig.postLoad(); }