/** * Set the ids in the configs * @param event */ @EventHandler public void preInit(FMLPreInitializationEvent event) { config = new Configuration(event.getSuggestedConfigurationFile()); try { config.load(); bedBlockID = config.getBlock("Guest Bed Block ID", bedBlockID).getInt(2000); bedItemID = config.getItem("Guest Bed Item ID", bedItemID).getInt(14000); } catch (Exception e) { e.printStackTrace(); } finally { config.save(); } }
public static void buildBlacklist(Configuration config) { config.addCustomCategoryComment( "ITEM_BLACKLIST", "Add here the blacklisted items (set them to true).\n" + "'item.' signifies an item, 'tile.' signifies a block.\n" + "Everytime this is changed, you probably should delete the price file.\n" + "(although this is not necessary.)"); Property configProperty; for (int i = 0; i < Item.itemsList.length; i++) { if (Item.itemsList[i] == null) continue; Boolean isBlackListed = false; if (defBlacklist != null){ isBlackListed = defBlacklist.get(Item.itemsList[i].itemID); if (isBlackListed == null){ isBlackListed = false; } } configProperty = config.get("ITEM_BLACKLIST", Item.itemsList[i].getUnlocalizedName(), isBlackListed); if (configProperty.getBoolean(false)) { addItemToBlacklist(Item.itemsList[i]); } } }
@EventHandler public void preInit(FMLPreInitializationEvent event) { Configuration config = new Configuration( event.getSuggestedConfigurationFile()); config.load(); itemCoinID = config.getItem("itemCoin", itemCoinID).getInt(); itemSSTackID = config.getItem("itemSmallCoinStack", itemSSTackID).getInt(); itemLStackID = config.getItem("itemLargeCoinStack", itemLStackID).getInt(); itemHeapID = config.getItem("itemCoinHeap", itemHeapID).getInt(); itemSellerID = config.getItem("itemSeller", itemSellerID).getInt(); blockTradeStationID = config.getBlock("blockTradeStation", blockTradeStationID).getInt(); config.save(); }
/** * Loads configurations from the properties file.<br> * - Remote item ID: (Remote.ID)<br> */ private static void loadConfig() { Configuration wirelessconfig = ConfigurationLib.getConfig(); wirelessconfig.load(); remoteID = wirelessconfig.get(Configuration.CATEGORY_ITEM, ItemLib.REMOTE, remoteID).getInt(); duraTogg = wirelessconfig.get(Configuration.CATEGORY_GENERAL, "Duration Toggle", duraTogg).getBoolean(duraTogg); pulseTime = wirelessconfig.get(Configuration.CATEGORY_GENERAL, "Pulse Time", pulseTime).getInt(); maxPulseThreads = wirelessconfig.get(Configuration.CATEGORY_GENERAL, "Max Threads", maxPulseThreads).getInt(); wirelessconfig.save(); }
public static void init(File file) { Configuration config = new Configuration(file); config.load(); /** Tooltip Sector **/ config.addCustomCategoryComment("Tooltip Options", "These are the options used to control how WikiLink displays tooltips on items when hovering over them in the inventory."); includeTooltipsOnItems = config.get("Tooltip Options", "includeTooltipsOnItems", true).getBoolean(true); /** Link Selection Sector **/ config.addCustomCategoryComment("Link Selection", "These are the options used to control the different links that appear inside of the WikiLink Menu."); enableWiki = config.get("Link Selection", "enableWiki", true).getBoolean(true); enableGoogle = config.get("Link Selection", "enableGoogle", true).getBoolean(true); enableThread = config.get("Link Selection", "enableThread", true).getBoolean(true); enableWebsite = config.get("Link Selection", "enableWebsite", true).getBoolean(true); enableYoutube = config.get("Link Selection", "enableYoutube", true).getBoolean(true); enableSummarize = config.get("Link Selection", "enableSummarize", true).getBoolean(true); /** Link Shortener Sector **/ config.addCustomCategoryComment("Link Shortener Options", "These are the options to change how WikiLink shortens all of it's hyperlinks."); shortenHyperlinks = config.get("Link Shortener Options", "shortenHyperlinks", true, "Use bit.ly to shorten links generated by WikiLink").getBoolean(true); debugMode = config.get("Debug Options", "debugMode", false, "Use this during startup/runtime to get your console spammed curtosy of WikiLink :)").getBoolean(false); config.save(); }
/** * Reads the config file. If it does not exist it is created. If properties * do not exist, they are created. */ public static void readConfig(){ ShoulderCamera.SHOULDER_ROTATION = (float) config.get(Configuration.CATEGORY_GENERAL, "rotationOffset", ShoulderCamera.SHOULDER_ROTATION, "Third person camera rotation").getDouble((double)ShoulderCamera.SHOULDER_ROTATION); ShoulderCamera.SHOULDER_ZOOM_MOD = (float) config.get(Configuration.CATEGORY_GENERAL, "zoomOffset" , ShoulderCamera.SHOULDER_ZOOM_MOD, "Third person camera zoom").getDouble((double)ShoulderCamera.SHOULDER_ZOOM_MOD); ShoulderSettings.IS_ROTATION_UNLIMITED = config.get(Configuration.CATEGORY_GENERAL, "isRotationUnlimited" , ShoulderSettings.IS_ROTATION_UNLIMITED, "Whether or not rotation adjustment has limits").getBoolean(ShoulderSettings.IS_ROTATION_UNLIMITED); ShoulderSettings.ROTATION_MAXIMUM = (float) config.get(Configuration.CATEGORY_GENERAL, "rotationMaximum" , ShoulderSettings.ROTATION_MAXIMUM, "If rotation is limited this is the maximum amount").getDouble((double)ShoulderSettings.ROTATION_MAXIMUM); ShoulderSettings.ROTATION_MINIMUM = (float) config.get(Configuration.CATEGORY_GENERAL, "rotationMinimum" , ShoulderSettings.ROTATION_MINIMUM, "If rotation is limited this is the minimum amount").getDouble((double)ShoulderSettings.ROTATION_MINIMUM); ShoulderSettings.IS_ZOOM_UNLIMITED = config.get(Configuration.CATEGORY_GENERAL, "isZoomUnlimited" , ShoulderSettings.IS_ZOOM_UNLIMITED, "Whether or not zoom adjustment has limits").getBoolean(ShoulderSettings.IS_ZOOM_UNLIMITED); ShoulderSettings.ZOOM_MAXIMUM = (float) config.get(Configuration.CATEGORY_GENERAL, "zoomMaximum" , ShoulderSettings.ZOOM_MAXIMUM, "If zoom is limited this is the maximum amount").getDouble((double)ShoulderSettings.ZOOM_MAXIMUM); ShoulderSettings.ZOOM_MINIMUM = (float) config.get(Configuration.CATEGORY_GENERAL, "zoomMinimum" , ShoulderSettings.ZOOM_MINIMUM, "If zoom is limited this is the minimum amount").getDouble((double)ShoulderSettings.ZOOM_MINIMUM); ShoulderSettings.TRACE_TO_HORIZON_LAST_RESORT = config.get(Configuration.CATEGORY_GENERAL, "alwaysHaveCrosshair" , ShoulderSettings.TRACE_TO_HORIZON_LAST_RESORT, "Whether or not to show a crosshair in the center of the screen if nothing is in range of you").getBoolean(ShoulderSettings.TRACE_TO_HORIZON_LAST_RESORT); ShoulderSettings.USE_CUSTOM_RAYTRACE_DISTANCE = config.get(Configuration.CATEGORY_GENERAL, "showCrosshairFarther" , ShoulderSettings.USE_CUSTOM_RAYTRACE_DISTANCE, "Whether or not to show the crosshairs farther than normal").getBoolean(ShoulderSettings.USE_CUSTOM_RAYTRACE_DISTANCE); ShoulderSettings.HIDE_PLAYER_IF_TOO_CLOSE_TO_CAMERA = config.get(Configuration.CATEGORY_GENERAL, "keepCameraOutOfHead" , ShoulderSettings.HIDE_PLAYER_IF_TOO_CLOSE_TO_CAMERA, "Whether or not to hide the player model if the camera gets too close to it").getBoolean(ShoulderSettings.HIDE_PLAYER_IF_TOO_CLOSE_TO_CAMERA); config.save(); }
/** * Reads the config file. If it does not exist it is created. If properties * do not exist, they are created. */ public static void readConfig(){ ShoulderSettings.IS_DYNAMIC_CROSSHAIR_ENABLED = config.get(Configuration.CATEGORY_GENERAL, "isCrosshairDynamic" , ShoulderSettings.IS_DYNAMIC_CROSSHAIR_ENABLED, "If enabled, then the crosshair moves around to line up with the block you are facing.").getBoolean(ShoulderSettings.IS_DYNAMIC_CROSSHAIR_ENABLED); ShoulderCamera.SHOULDER_ROTATION = (float) config.get(Configuration.CATEGORY_GENERAL, "rotationOffset", ShoulderCamera.SHOULDER_ROTATION, "Third person camera rotation").getDouble((double)ShoulderCamera.SHOULDER_ROTATION); ShoulderCamera.SHOULDER_ZOOM_MOD = (float) config.get(Configuration.CATEGORY_GENERAL, "zoomOffset" , ShoulderCamera.SHOULDER_ZOOM_MOD, "Third person camera zoom").getDouble((double)ShoulderCamera.SHOULDER_ZOOM_MOD); ShoulderSettings.IS_ROTATION_UNLIMITED = config.get(Configuration.CATEGORY_GENERAL, "isRotationUnlimited" , ShoulderSettings.IS_ROTATION_UNLIMITED, "Whether or not rotation adjustment has limits").getBoolean(ShoulderSettings.IS_ROTATION_UNLIMITED); ShoulderSettings.ROTATION_MAXIMUM = (float) config.get(Configuration.CATEGORY_GENERAL, "rotationMaximum" , ShoulderSettings.ROTATION_MAXIMUM, "If rotation is limited this is the maximum amount").getDouble((double)ShoulderSettings.ROTATION_MAXIMUM); ShoulderSettings.ROTATION_MINIMUM = (float) config.get(Configuration.CATEGORY_GENERAL, "rotationMinimum" , ShoulderSettings.ROTATION_MINIMUM, "If rotation is limited this is the minimum amount").getDouble((double)ShoulderSettings.ROTATION_MINIMUM); ShoulderSettings.IS_ZOOM_UNLIMITED = config.get(Configuration.CATEGORY_GENERAL, "isZoomUnlimited" , ShoulderSettings.IS_ZOOM_UNLIMITED, "Whether or not zoom adjustment has limits").getBoolean(ShoulderSettings.IS_ZOOM_UNLIMITED); ShoulderSettings.ZOOM_MAXIMUM = (float) config.get(Configuration.CATEGORY_GENERAL, "zoomMaximum" , ShoulderSettings.ZOOM_MAXIMUM, "If zoom is limited this is the maximum amount").getDouble((double)ShoulderSettings.ZOOM_MAXIMUM); ShoulderSettings.ZOOM_MINIMUM = (float) config.get(Configuration.CATEGORY_GENERAL, "zoomMinimum" , ShoulderSettings.ZOOM_MINIMUM, "If zoom is limited this is the minimum amount").getDouble((double)ShoulderSettings.ZOOM_MINIMUM); ShoulderSettings.TRACE_TO_HORIZON_LAST_RESORT = config.get(Configuration.CATEGORY_GENERAL, "alwaysHaveCrosshair" , ShoulderSettings.TRACE_TO_HORIZON_LAST_RESORT, "Whether or not to show a crosshair in the center of the screen if nothing is in range of you").getBoolean(ShoulderSettings.TRACE_TO_HORIZON_LAST_RESORT); ShoulderSettings.USE_CUSTOM_RAYTRACE_DISTANCE = config.get(Configuration.CATEGORY_GENERAL, "showCrosshairFarther" , ShoulderSettings.USE_CUSTOM_RAYTRACE_DISTANCE, "Whether or not to show the crosshairs farther than normal").getBoolean(ShoulderSettings.USE_CUSTOM_RAYTRACE_DISTANCE); ShoulderSettings.HIDE_PLAYER_IF_TOO_CLOSE_TO_CAMERA = config.get(Configuration.CATEGORY_GENERAL, "keepCameraOutOfHead" , ShoulderSettings.HIDE_PLAYER_IF_TOO_CLOSE_TO_CAMERA, "Whether or not to hide the player model if the camera gets too close to it").getBoolean(ShoulderSettings.HIDE_PLAYER_IF_TOO_CLOSE_TO_CAMERA); config.save(); }
/** * Reads the config file. If it does not exist it is created. If properties * do not exist, they are created. */ public static void readConfig(){ ShoulderHelper.SHOULDER_ROTATION = (float) config.get(Configuration.CATEGORY_GENERAL, "rotationOffset", ShoulderHelper.SHOULDER_ROTATION, "Third person camera rotation").getDouble((double)ShoulderHelper.SHOULDER_ROTATION); ShoulderHelper.SHOULDER_ZOOM_MOD = (float) config.get(Configuration.CATEGORY_GENERAL, "zoomOffset" , ShoulderHelper.SHOULDER_ZOOM_MOD, "Third person camera zoom").getDouble((double)ShoulderHelper.SHOULDER_ZOOM_MOD); ShoulderHelper.IS_ROTATION_UNLIMITED = config.get(Configuration.CATEGORY_GENERAL, "isRotationUnlimited" , ShoulderHelper.IS_ROTATION_UNLIMITED, "Whether or not rotation adjustment has limits").getBoolean(ShoulderHelper.IS_ROTATION_UNLIMITED); ShoulderHelper.ROTATION_MAXIMUM = (float) config.get(Configuration.CATEGORY_GENERAL, "rotationMaximum" , ShoulderHelper.ROTATION_MAXIMUM, "If rotation is limited this is the maximum amount").getDouble((double)ShoulderHelper.ROTATION_MAXIMUM); ShoulderHelper.ROTATION_MINIMUM = (float) config.get(Configuration.CATEGORY_GENERAL, "rotationMinimum" , ShoulderHelper.ROTATION_MINIMUM, "If rotation is limited this is the minimum amount").getDouble((double)ShoulderHelper.ROTATION_MINIMUM); ShoulderHelper.IS_ZOOM_UNLIMITED = config.get(Configuration.CATEGORY_GENERAL, "isZoomUnlimited" , ShoulderHelper.IS_ZOOM_UNLIMITED, "Whether or not zoom adjustment has limits").getBoolean(ShoulderHelper.IS_ZOOM_UNLIMITED); ShoulderHelper.ZOOM_MAXIMUM = (float) config.get(Configuration.CATEGORY_GENERAL, "zoomMaximum" , ShoulderHelper.ZOOM_MAXIMUM, "If zoom is limited this is the maximum amount").getDouble((double)ShoulderHelper.ZOOM_MAXIMUM); ShoulderHelper.ZOOM_MINIMUM = (float) config.get(Configuration.CATEGORY_GENERAL, "zoomMinimum" , ShoulderHelper.ZOOM_MINIMUM, "If zoom is limited this is the minimum amount").getDouble((double)ShoulderHelper.ZOOM_MINIMUM); ShoulderHelper.TRACE_TO_HORIZON_LAST_RESORT = config.get(Configuration.CATEGORY_GENERAL, "alwaysHaveCrosshair" , ShoulderHelper.TRACE_TO_HORIZON_LAST_RESORT, "Whether or not to show a crosshair in the center of the screen if nothing is in range of you").getBoolean(ShoulderHelper.TRACE_TO_HORIZON_LAST_RESORT); ShoulderHelper.USE_CUSTOM_RAYTRACE_DISTANCE = config.get(Configuration.CATEGORY_GENERAL, "showCrosshairFarther" , ShoulderHelper.USE_CUSTOM_RAYTRACE_DISTANCE, "Whether or not to show the crosshairs farther than normal").getBoolean(ShoulderHelper.USE_CUSTOM_RAYTRACE_DISTANCE); ShoulderHelper.HIDE_PLAYER_IF_TOO_CLOSE_TO_CAMERA = config.get(Configuration.CATEGORY_GENERAL, "keepCameraOutOfHead" , ShoulderHelper.HIDE_PLAYER_IF_TOO_CLOSE_TO_CAMERA, "Whether or not to hide the player model if the camera gets too close to it").getBoolean(ShoulderHelper.HIDE_PLAYER_IF_TOO_CLOSE_TO_CAMERA); config.save(); }
public ConfigurationHandler(File file) { this.config = new Configuration(file); try{ config.load(); config.addCustomCategoryComment("ModSettings", "Here you can change what the mod loads"); Constants.DEF_DARKLOAD = config.get("ModSettings", "DarkElements", false, "Toggles the Dark Elemental Load").getBoolean(false); Constants.DEF_DPARTICLESLOAD = config.get("ModSettings", "DarkParticles", true, "Toggles the Dark Particles Load").getBoolean(true); Constants.DEF_HEALING = config.get("ModSettings", "Healing", false, "Toggles the Healing ability of ALL Zero Quest tameable creatures").getBoolean(false); } catch(Exception e){ L.log(Level.SEVERE, "Zero Quest encounted a problem while loading the config file: ", e); } finally{ config.save(); } }
@EventHandler public void preInit(FMLPreInitializationEvent event) { Configuration config = new Configuration( event.getSuggestedConfigurationFile()); config.load(); betterhopperid = config.getBlock("BetterHopper", 2800).getInt(); fasterhopperid = config.getBlock("FasterHopper", 2801).getInt(); biggerhopperid = config.getBlock("BiggerHopper", 2802).getInt(); strongerhopperid = config.getBlock("StrongerHopper", 2803).getInt(); fasterstrongerhopperid = config.getBlock("FasterStrongerHopper", 2804).getInt(); fasterbiggerhopperid = config.getBlock("FasterBiggerHopper", 2805).getInt(); biggerstrongerhopperid = config.getBlock("BiggerStrongerHopper", 2806).getInt(); fasterbiggerstrongerhopperid = config.getBlock("FasterBiggerStrongerHopper", 2807).getInt(); config.addCustomCategoryComment("Enable", "Enable/Disable"); enableBetterHopper = config.get("Enable", "BetterHopper", true).getBoolean(true); enableFasterHopper = config.get("Enable", "FasterHopper", true).getBoolean(true); enableBiggerHopper = config.get("Enable", "BiggerHopper", true).getBoolean(true); enableStrongerHopper = config.get("Enable", "StrongerHopper", true).getBoolean(true); config.save(); }
@PreInit public void preInit(FMLPreInitializationEvent event) { apLogger.setParent(FMLLog.getLogger()); apLogger.info("[Apocalyptic] Starting pre-initialization"); apLogger.info("[Apocalyptic] Loading configuration"); isServer = event.getSide().isServer(); Configuration config = new Configuration(event.getSuggestedConfigurationFile()); tePerChunk = config.get("general", "TileEntitiesPerChunk", 900).getInt(900); silverfishChance = config.get("general", "SilverfishSpawnChance", 0.001).getDouble(0.001); transferLimit = config.get("transfer", "limit", new String[]{"0:0:0", "1:X:1"}).getStringList(); transferTagRemove = config.get("transfer", "tag-remove", new String[]{"0:0", "1:X"}).getStringList(); //databaseURL = config.get("database", "URL", "jdbc:mysql://site.ru:3306/database").getString(); //databaseUsername = config.get("database", "Username", "Username").getString(); //databasePassword = config.get("database", "Password", "Password").getString(); config.load(); config.save(); this.initCustomPotions(event); apLogger.info("[Apocalyptic] Pre-initialization completed"); }
@Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { saveDat = new File(event.getSuggestedConfigurationFile().getParentFile().getAbsolutePath() + "/" + MODID + "/savedInv.dat"); create(saveDat); recipeDat = new File(event.getSuggestedConfigurationFile().getParentFile().getAbsolutePath() + "/" + MODID + "/savedRecipe.dat"); create(recipeDat); GameRegistry.registerPlayerTracker(new PlayerTracker()); //Config File configFile = new File(event.getSuggestedConfigurationFile().getParentFile().getAbsolutePath() + "/" + MODID + "/specificInventory.cfg"); create(configFile); Configuration config = new Configuration(configFile); config.load(); canModify = config.get("canModify", "general", false, "Can modify starting inventory.").getBoolean(false); freshInventory = config.get("replaceInventory","general",false, "true = replaces entire inventory. false = add items to inventory.").getBoolean(false); config.save(); }
public static void init(File configFile) { configuration = new Configuration(configFile); try { ItemIds.MODULE = configuration.getItem(Strings.MODULE_BASE_NAME, ItemIds.MODULE_DEFAULT).getInt(ItemIds.MODULE_DEFAULT); ItemIds.BUDDY = configuration.getItem(Strings.BUDDY_NAME, ItemIds.BUDDY_DEFAULT).getInt(ItemIds.BUDDY_DEFAULT); ItemIds.CHIPSET = configuration.getItem(Strings.CHIPSET_BASE_NAME, ItemIds.CHIPSET_DEFAULT).getInt(ItemIds.CHIPSET_DEFAULT); ItemIds.ROBOT = configuration.getItem(Strings.ROBOT_NAME, ItemIds.ROBOT_DEFAULT).getInt(ItemIds.ROBOT_DEFAULT); BlockIds.FACTORY_CONTROLLER = configuration.getBlock(Strings.FACTORY_CONTROLLER_NAME, BlockIds.FACTORY_CONTROLLER_DEFAULT).getInt(BlockIds.FACTORY_CONTROLLER_DEFAULT); BlockIds.FACTORY_BASE = configuration.getBlock(Strings.FACTORY_BASE_NAME, BlockIds.FACTORY_BASE_DEFAULT).getInt(BlockIds.FACTORY_BASE_DEFAULT); BlockIds.FACTORY_ENERGY = configuration.getBlock(Strings.FACTORY_ENERGY_NAME, BlockIds.FACTORY_ENERGY_DEFAULT).getInt(BlockIds.FACTORY_ENERGY_DEFAULT); } catch (Exception e) { FMLLog.log(Level.SEVERE, e, Reference.MOD_NAME + " has had a problem loading its configuration"); } finally { configuration.save(); } }
public static void loadConfig(FMLPreInitializationEvent event) { Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); teamSelectionId = config.getBlock("teamSelectionBlock", 500).getInt(); unbreakableGlassId = config.getBlock("unbreakableGlass", 501).getInt(); gameMod = config.get(Configuration.CATEGORY_GENERAL, "gameMod", "onlinefreak").getString(); dimensionId = config.get(Configuration.CATEGORY_GENERAL, "dimensionId", 5).getInt(); maxTeams = config.get(Configuration.CATEGORY_GENERAL, "maxTeams", 7).getInt(); pvpPreventionMinutes = config.get(Configuration.CATEGORY_GENERAL, "pvpPreventionMinutes", 30).getInt(); pvpFriendlyFireOn = config.get("PVP", "pvpFriendlyFireOn", false).getBoolean(false); if (pvpPreventionMinutes < 0) pvpPreventionMinutes = 0; config.save(); }
public static void init(final File suggestedConfigurationFile) { ConfigHandler.configuration = new Configuration(suggestedConfigurationFile); try { ConfigHandler.configuration.load(); } catch (final Exception ex) { Agriculture.instance.getLogger().warning("Could not load configurations. Reason" + ex.getMessage()); } finally { if (ConfigHandler.configuration.hasChanged()) { ConfigHandler.configuration.save(); } } }
/** @param idsConfig Forge configuration file which holds Block and Item IDs. * @param config a class containing static fields with Blocks and Items. */ public static void preLoad(Configuration idConfig, Class config) { try { idConfig.load(); Field[] fields = config.getFields(); for (Field field : fields) { if (field.getType().equals(CfgInfo.class)) { CfgInfo<?> info = (CfgInfo)field.get(null); info.initialize(field); int id = info.id; if (info.isBlock()) { id = idConfig.getBlock(field.getName(), id).getInt(); } else { id = idConfig.getItem(field.getName(), id).getInt(); } info.id = id; } } } catch(Exception e) { Dota2Items.logger.severe("Failed to load config: " + e.toString()); } finally { idConfig.save(); } }
public static void initialize(File file) { Configuration config = new Configuration(file); config.load(); PlanksID = config.getBlock("Plank IDs", 509).getInt(); StonesID = config.getBlock("Stone IDs", 510).getInt(); StoneBricksID = config.getBlock("Stone Brick IDs", 511).getInt(); ReinforcedBricksID = config.getBlock("Reinforced Brick IDs", 512).getInt(); Rare = config.get("Generation", "Rarity of Stones", 3).getInt(); for (String id : config.get("Generation", "Allowed Dimension ID", "0,").getString().split(",")) { try { allowed.add(Integer.parseInt(id.trim())); } catch (NumberFormatException e) { } } config.save(); }
public void universalPreInit(FMLPreInitializationEvent event) { Configuration config = new Configuration(event.getSuggestedConfigurationFile()); packets = Network.newChannel("SevenCommons") .register(PacketSync.class, SYNC_PACKET_ID) .register(PacketInventoryName.class) .register(PacketContainerButton.class) .build(); ClassInfoUtil.preInit(); // initialize the lazy statics in the scheduler class Reflection.initialize(Scheduler.class); TickRegistry.registerTickHandler(new SCPlayerTicker(), Side.SERVER); GameRegistry.registerPlayerTracker(new SCPlayerTracker()); proxy.preInit(event); Syncing.registerFactory(Object.class, new BuiltinSyncers()); ToNbtFactories.registerFactory(Object.class, new DefaultNBTSerializers()); }
@PreInit public void preInit(FMLPreInitializationEvent event) { Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); boolean checkForDatabaseUpdates = config.get("general", "Check for database updates", true).getBoolean(true); modDirectory = new File(event.getModConfigurationDirectory().getParent()); if (!DBHelper.has(checkForDatabaseUpdates)) { throw new RuntimeException("Can not start Pixelmon without SQLite jar or database!!! Please reinstall!!"); } if (Loader.isModLoaded("Pokemobs")) System.exit(1); event.getModMetadata().version = "2.2"; MaemeConfig.loadConfig(config); }
private void setDefaultValues() { try { SCVestaConfigManager.configuration.load(); SCVestaConfigManager.dimensionIDVesta = SCVestaConfigManager.configuration.get("Dimensions", "Vesta Dimension ID", -42).getInt(-42); SCVestaConfigManager.idItemVestaBasic = SCVestaConfigManager.configuration.get(Configuration.CATEGORY_ITEM, "idItemVestaItemBasic", 6756).getInt(6756); } catch (final Exception e) { FMLLog.log(Level.SEVERE, e, "Starcraft Vesta has a problem loading it's configuration"); } finally { SCVestaConfigManager.configuration.save(); SCVestaConfigManager.loaded = true; } }
private void setDefaultValues() { try { SCErisConfigManager.configuration.load(); SCErisConfigManager.dimensionIDEris = SCErisConfigManager.configuration.get("Dimensions", "Eris Dimension ID", -48).getInt(-48); SCErisConfigManager.idItemErisBasic = SCErisConfigManager.configuration.get(Configuration.CATEGORY_ITEM, "idItemErisBasic", 9777).getInt(9777); SCErisConfigManager.generateOtherMods = SCErisConfigManager.configuration.get(Configuration.CATEGORY_GENERAL, "Generate other mod's features on Eris", false).getBoolean(false); } catch (final Exception e) { FMLLog.log(Level.SEVERE, e, "Starcraft Eris has a problem loading it's configuration"); } finally { SCErisConfigManager.configuration.save(); SCErisConfigManager.loaded = true; } }
public static void initMain(File file) { Configuration config = new Configuration(file); config.load(); HerbologicaIDs.BUSH_BLOCK = config.getBlock(HerbologicaIDs.BLOCK_CONFIG_CATEGORY, HerbologicaIDs.BUSH_BLOCK_KEY, HerbologicaIDs.BUSH_BLOCK_DEFAULT).getInt(); HerbologicaIDs.PLANT = config.getBlock(HerbologicaIDs.BLOCK_CONFIG_CATEGORY, HerbologicaIDs.PLANT_KEY, HerbologicaIDs.PLANT_DEFAULT).getInt(); HerbologicaIDs.COFFEE_BLOCK = config.getBlock(HerbologicaIDs.BLOCK_CONFIG_CATEGORY, HerbologicaIDs.COFFEE_BLOCK_KEY, HerbologicaIDs.COFFEE_BLOCK_DEFAULT).getInt(); HerbologicaIDs.TEA_BLOCK = config.getBlock(HerbologicaIDs.BLOCK_CONFIG_CATEGORY, HerbologicaIDs.TEA_BLOCK_KEY, HerbologicaIDs.TEA_BLOCK_DEFAULT).getInt(); HerbologicaIDs.BERRY = config.getItem(HerbologicaIDs.ITEM_CONFIG_CATEGORY, HerbologicaIDs.BERRY_KEY, HerbologicaIDs.BERRY_DEFAULT).getInt(); HerbologicaIDs.FRUIT = config.getItem(HerbologicaIDs.ITEM_CONFIG_CATEGORY, HerbologicaIDs.FRUIT_KEY, HerbologicaIDs.FRUIT_DEFAULT).getInt(); HerbologicaIDs.VEGETABLE = config.getItem(HerbologicaIDs.ITEM_CONFIG_CATEGORY, HerbologicaIDs.VEGETABLE_KEY, HerbologicaIDs.VEGETABLE_DEFAULT).getInt(); HerbologicaIDs.MUG = config.getItem(HerbologicaIDs.ITEM_CONFIG_CATEGORY, HerbologicaIDs.MUG_KEY, HerbologicaIDs.MUG_DEFAULT).getInt(); config.save(); }
public static void createConfig(FMLPreInitializationEvent event) { Configuration config = new Configuration(new File(event.getModConfigurationDirectory() + "Updater.cfg")); try { config.load(); DataProxy.versionurl = config.get(Reference.options, "URL used to check for updates", "http://www.dnstechpack.com/<path>").getString(); DataProxy.infourl = config.get(Reference.options, "URL used to provide update info", "http://www.dnstechpack.com/<path>").getString(); DataProxy.delay = config.get(Reference.options, "How long to wait before notifications are shown", 200).getInt(); Reference.updaterName = config.get(Reference.options, "Name of the modpack the updater will use", "DNS Techpack").getString(); Reference.outputColour = config.get(Reference.options, "The colout the updater will use", "green").getString(); Reference.allowCape = config.get(Reference.options, "Do you want to enable cape rendering", true).getBoolean(true); } catch(Exception e) { e.printStackTrace(); } finally { if(config.hasChanged()) config.save(); } }
private void setDefaultValues() { try { SCTitanConfigManager.configuration.load(); SCTitanConfigManager.dimensionIDTitan = SCTitanConfigManager.configuration.get("Dimensions", "Titan Dimension ID", -73).getInt(-73); SCTitanConfigManager.idItemTitanBasic = SCTitanConfigManager.configuration.get(Configuration.CATEGORY_ITEM, "idItemTitanItemBasic", 7759).getInt(7759); } catch (final Exception e) { FMLLog.log(Level.SEVERE, e, "Starcraft Titan has a problem loading it's configuration"); } finally { SCTitanConfigManager.configuration.save(); SCTitanConfigManager.loaded = true; } }
public static void init(Configuration fConfig) { config = fConfig; try { config.load(); //Blocks deceptionBlock = config.getBlock("Blocks", "deceptionBlock", getBlockID()).getInt(); //Items itemHeart = config.getItem("Items", "Heart", getItemID()).getInt(); itemMasterSword = config.getItem("Gear", "MasterSword", getItemID()).getInt(); itemLens = config.getItem("Items", "Lens Of Truth", getItemID()).getInt(); dekuStick = config.getItem("Gear", "Deku Stick", getItemID()).getInt(); //Reference values renderMasterSword = config.get("Sword", "UseMasterSwordModel", false).getBoolean(false); } catch (Exception e) { FMLLog.log(Level.SEVERE, e, Reference.MOD_NAME + " has had a problem loading its block configuration"); } finally { config.save(); } }
@EventHandler public void preInit(FMLPreInitializationEvent event) { TTPLogger.init(); ConfigHandler.init(new Configuration(event.getSuggestedConfigurationFile())); ModBlocks.init(); ModTile.init(); ModItems.init(); ModEntities.init(); MinecraftForge.EVENT_BUS.register(new HarvestHandler()); MinecraftForge.EVENT_BUS.register(new HandlerTunic()); MinecraftForge.EVENT_BUS.register(new HandlerBoots()); deceptionRenderer = RenderingRegistry.getNextAvailableRenderId(); proxy.runClientSide(); }
public static void init(Configuration config) { ModJam.carvingStone = new BlockCarvingStone(config.getBlock("Carving Stone", 1100).getInt(1100)); ModJam.decoration = new BlockDecoration(config.getBlock("Decorative Blocks", 1101).getInt(1101)); ModJam.mageSlab = new SlabDecoration(config.getBlock("Decorative Slabs", 1102).getInt(1102)); // ModJam.lamp = new BlockMagebrickLamp(config.getBlock("Magebrick Lamp", 1104).getInt(1104)); ModJam.item = new ItemMulti(config.getItem("Main Items", 5500).getInt(5500)); ModJam.runes = new ItemRune(config.getItem("Runes", 5501).getInt(5501)); ModJam.scroll = new ItemPapyrus(config.getItem("Papyrus Scroll", 5502).getInt(5502)); ModJam.staff = new ItemStaff(config.getItem("Staffs", 5503).getInt(5503)); ModJam.reaper = new ToolReaper(config.getItem("Reaper", 5504).getInt(5504)); ModJam.essence = new ItemCrystal(config.getItem("Crystalline Essence", 5505).getInt(5505)); config.save(); }
@EventHandler public void preInit(FMLPreInitializationEvent evt) { Configuration config = new Configuration(evt.getSuggestedConfigurationFile()); config.load(); Property updateI = config.get(Configuration.CATEGORY_GENERAL, "update Interval", 1000); updateI.comment = "Update Interval time for all EntityLiving in milliseconds. The lower the better and costlier."; updateInterval = updateI.getInt(); itemsMap = new HashMap<Integer, Integer>(); Property itemsList = config.get(Configuration.CATEGORY_GENERAL, "LightItems", "50:15,89:12,348:10,91:15,327:15,76:10,331:10,314:14"); itemsList.comment = "Item and Armor IDs that shine light when found on any EntityLiving. Syntax: ItemID:LightValue, seperated by commas"; String[] tokens = itemsList.getString().split(","); for (String pair : tokens) { String[] values = pair.split(":"); int id = Integer.valueOf(values[0]); int value = Integer.valueOf(values[1]); itemsMap.put(id, value); } config.save(); }
@EventHandler public void preInit(FMLPreInitializationEvent evt) { Configuration config = new Configuration(evt.getSuggestedConfigurationFile()); config.load(); Property itemsList = config.get(Configuration.CATEGORY_GENERAL, "LightItems", "50,89=12,348=10,91,327,76=10,331=10,314=14"); itemsList.comment = "Item IDs that shine light while held. Armor Items also work when worn. [ONLY ON OTHERS] Syntax: ItemID[-MetaValue]:LightValue, seperated by commas"; itemsMap = new ItemConfigHelper(itemsList.getString(), 15); Property updateI = config.get(Configuration.CATEGORY_GENERAL, "update Interval", 1000); updateI.comment = "Update Interval time for all other player entities in milliseconds. The lower the better and costlier."; updateInterval = updateI.getInt(); config.save(); }
@EventHandler public void preInit(FMLPreInitializationEvent evt) { Configuration config = new Configuration(evt.getSuggestedConfigurationFile()); config.load(); Property itemsList = config.get(Configuration.CATEGORY_GENERAL, "LightItems", "50,89=12,348=10,91,327,76=10,331=10,314=14"); itemsList.comment = "Item IDs that shine light when dropped in the World."; itemsMap = new ItemConfigHelper(itemsList.getString(), 15); Property updateI = config.get(Configuration.CATEGORY_GENERAL, "update Interval", 1000); updateI.comment = "Update Interval time for all Item entities in milliseconds. The lower the better and costlier."; updateInterval = updateI.getInt(); Property notWaterProofList = config.get(Configuration.CATEGORY_GENERAL, "TurnedOffByWaterItems", "50,327"); notWaterProofList.comment = "Item IDs that do not shine light when dropped and in water, have to be present in LightItems."; notWaterProofItems = new ItemConfigHelper(notWaterProofList.getString(), 1); config.save(); }
@EventHandler public void preInit(FMLPreInitializationEvent evt) { Configuration config = new Configuration(evt.getSuggestedConfigurationFile()); config.load(); Property itemsList = config.get(Configuration.CATEGORY_GENERAL, "LightItems", "50,89=12,348=10,91,327,76=10,331=10,314=14"); itemsList.comment = "Item IDs that shine light while held. Armor Items also work when worn. [ONLY ON YOURSELF]"; itemsMap = new ItemConfigHelper(itemsList.getString(), 15); Property notWaterProofList = config.get(Configuration.CATEGORY_GENERAL, "TurnedOffByWaterItems", "50,327"); notWaterProofList.comment = "Item IDs that do not shine light when held in water, have to be present in LightItems."; notWaterProofItems = new ItemConfigHelper(notWaterProofList.getString(), 1); config.save(); }
@EventHandler public void preModInit(FMLPreInitializationEvent event) { Configuration cfg = new Configuration(event.getSuggestedConfigurationFile()); try { cfg.load(); HandlersInit.DROPFISH = cfg.get(Configuration.CATEGORY_GENERAL, HandlersInit.DROPFISH_NAME, HandlersInit.DROPFISH_DEFAULT).getBoolean(HandlersInit.DROPFISH_DEFAULT); HandlersInit.EGGDROPCHANCE = cfg.get(Configuration.CATEGORY_GENERAL, HandlersInit.EGGDROPCHANCE_NAME, HandlersInit.EGGDROPCHANCE_DEFAULT).getDouble(HandlersInit.EGGDROPCHANCE_DEFAULT); HandlersInit.FISHCHANCE = cfg.get(Configuration.CATEGORY_GENERAL, HandlersInit.FISHCHANCE_NAME, HandlersInit.FISHCHANCE_DEFAULT).getDouble(HandlersInit.FISHCHANCE_DEFAULT); } catch (Exception e) { FMLLog.log(Level.SEVERE, e, ModLib.MOD_NAME + " has a problem loading it's configuration"); } finally { if (cfg.hasChanged()) cfg.save(); } LanguageRegistry.instance().loadLocalization(ModLib.LANG_RESOURCE_LOCATION + "en_US.xml", "en_US", true); }
public static void init(File file){ config = new Configuration(file); try{ config.load(); BlockIds.CUSTOMBLOCK_ID = config.getBlock(Strings.CUSTOMBLOCK_NAME, BlockIds.CUSTOMBLOCK_ID_DEFAULT).getInt(BlockIds.CUSTOMBLOCK_ID_DEFAULT); BlockIds.CUSTOMSTATICBLOCK_ID = config.getBlock(Strings.CUSTOMSTATICBLOCK_NAME, BlockIds.CUSTOMSTATICBLOCK_ID_DEFAULT).getInt(BlockIds.CUSTOMSTATICBLOCK_ID_DEFAULT); ItemIds.CUSTOMITEM_ID = config.getItem(Strings.CUSTOMITEM_NAME, ItemIds.CUSTOMITEM_ID_DEFAULT).getInt(ItemIds.CUSTOMITEM_ID_DEFAULT); ItemIds.CUSTOMSTATICITEM_ID = config.getItem(Strings.CUSTOMSTATICITEM_NAME, ItemIds.CUSTOMSTATICITEM_ID_DEFAULT).getInt(ItemIds.CUSTOMSTATICITEM_ID_DEFAULT); } catch(Exception e){ FMLLog.log(Level.SEVERE, e, Reference.MOD_ID + "has a problem loading the config file"); } finally{ config.save(); } }
@PreInit public void preInit(FMLPreInitializationEvent event) { // TODO: Read configuration files for blocks and items Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); //someConfigFlag = Boolean.parseBoolean(config.get(ConfigCategory_Generic, "someConfig", "true").value); config.addCustomCategoryComment(ConfigCategory_Generic, "All generic settings for questcraft"); Property someConfig = config.get(ConfigCategory_Generic, "someConfig", "true"); someConfig.comment = "Configure some configuration setting (true/false). Default true"; someConfigFlag = someConfig.getBoolean(true); Property questInstanceItemIDProperty = config.get(ConfigCategory_Generic, "quest-instance-item-id", "5000"); questInstanceItemIDProperty.comment = "Item ID used for quest instance items"; questInstanceItemID = questInstanceItemIDProperty.getInt(5000); config.save(); }
@EventHandler public void preInit(FMLPreInitializationEvent event) { AestusCraft.log = Logger.getLogger("AestusCraft"); AestusCraft.log.setParent(FMLLog.getLogger()); AestusCraft.config = new Configuration(event.getSuggestedConfigurationFile()); Config.initialize(config); Registry.initialize(); AestusCraftAPI.initialize(); AestusCraft.content = new Content(); content.registerBlocks(); content.registerItems(); proxy.initRendering(); NetworkRegistry.instance().registerGuiHandler(instance, proxy); buildcraft = new BuildCraftIntegration(); if (buildcraft.shouldLoad()) { buildcraft.config(config); buildcraft.preInit(); } }
@EventHandler public void preInit(FMLPreInitializationEvent event) { Log.logger = event.getModLog(); Configuration cfg = new Configuration(event.getSuggestedConfigurationFile()); try { cfg.load(); itemTagId = cfg.getItem("itemTag", 27412).getInt(); itemMiscId = cfg.getItem("itemMisc", 27413).getInt(); itemReaderId = cfg.getItem("itemReader", 27414).getInt(); itemManipulatorId = cfg.getItem("itemManipulator", 27415).getInt(); blockPeripheralId = cfg.getBlock("blockTagPeripheral", 2324).getInt(); config = new Config(cfg); tabTags = new CreativeTabTags(CreativeTabs.getNextID()); } catch (Exception e) { Log.severe(e, "Error during config reading"); } finally { cfg.save(); } }
/** * Called when the mod is in the pre-initialization phase. * * @param event - the event information * @throws IOException thrown on one of the many IO errors */ @EventHandler public void preInit(FMLPreInitializationEvent event) throws IOException { LogHelper.info("Pre-initializing..."); // TODO: find a way to make this not work client side. //if(proxy instanceof MCManagerClientProxy) // throw new RuntimeException("This is a server-side only mod."); server = MinecraftServer.getServer(); configDir = new File(event.getSuggestedConfigurationFile().getParent() + "/MCManager"); if(!configDir.exists()) configDir.mkdir(); coreConfig = new Configuration(new File(configDir, "MCManager.cfg")); }