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 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(); }
@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(); }
public static void init(CellariumConfiguration main) { Property bloodHelmetId = main.getItem("bloodHelmet.id", DefaultProps.BLOOD_HELMET); Property bloodChestId = main.getItem("bloodChest.id", DefaultProps.BLOOD_CHEST); Property bloodPantsId = main.getItem("bloodPants.id", DefaultProps.BLOOD_PANTS); Property bloodBootsId = main.getItem("bloodBoots.id", DefaultProps.BLOOD_BOOTS); bloodHelmet = new BloodArmor(bloodHelmetId.getInt(), bloodMaterial, Cellarium.proxy.addArmor("blood"), 0, "bloodHelmet", "blood"); bloodChest = new BloodArmor(bloodChestId.getInt(), bloodMaterial, Cellarium.proxy.addArmor("blood"), 1, "bloodChest", "blood"); bloodPants = new BloodArmor(bloodPantsId.getInt(), bloodMaterial, Cellarium.proxy.addArmor("blood"), 2, "bloodPants", "blood"); bloodBoots = new BloodArmor(bloodBootsId.getInt(), bloodMaterial, Cellarium.proxy.addArmor("blood"), 3, "bloodBoots", "blood"); Property tearsHelmetId = main.getItem("tearsHelmet.id", DefaultProps.TEARS_HELMET); Property tearsChestId = main.getItem("tearsChest.id", DefaultProps.TEARS_CHEST); Property tearsPantsId = main.getItem("tearsPants.id", DefaultProps.TEARS_PANTS); Property tearsBootsId = main.getItem("tearsBoots.id", DefaultProps.TEARS_BOOTS); tearsHelmet = new TearsArmor(tearsHelmetId.getInt(),tearsMaterial, Cellarium.proxy.addArmor("tears"), 0, "tearsHelmet", "tears"); tearsChest = new TearsArmor(tearsChestId.getInt(),tearsMaterial, Cellarium.proxy.addArmor("tears"), 1, "tearsChest", "tears"); tearsPants = new TearsArmor(tearsPantsId.getInt(),tearsMaterial, Cellarium.proxy.addArmor("tears"), 2, "tearsPants", "tears"); tearsBoots = new TearsArmor(tearsBootsId.getInt(),tearsMaterial, Cellarium.proxy.addArmor("tears"), 3, "tearsBoots", "tears"); }
public static void loadItemsFromConfig(Configuration config) { config.addCustomCategoryComment( "ITEM_PRICES", "Add here the item prices.\n" + "-1 means no price is set.\n" + "'item.' signifies an item, 'tile.' signifies a block."); Property configProperty; int price; for (int i = 0; i < Item.itemsList.length; i++) { if (Item.itemsList[i] == null || isBlacklisted(Item.itemsList[i])) continue; Integer defaultPrice = -1; if (defPrices != null){ defaultPrice = defPrices.get(Item.itemsList[i].itemID); if (defaultPrice == null){ defaultPrice = -1; } } configProperty = config.get("ITEM_PRICES", Item.itemsList[i].getUnlocalizedName(), defaultPrice); price = configProperty.getInt(); if (price != -1) { addItemToList(Item.itemsList[i], price); } } }
@Mod.EventHandler public void preInit( FMLPreInitializationEvent event ) { // Load config Configuration config = new Configuration( event.getSuggestedConfigurationFile() ); config.load(); // Setup blocks Property prop = config.getBlock("billundBlockID", 2642); prop.comment = "The Block ID for Billund Blocks"; billundBlockID = prop.getInt(); // Setup items prop = config.getItem("brickItemID", 6242); prop.comment = "The Item ID for Billund Bricks"; brickItemID = prop.getInt(); prop = config.getItem("orderFormItemID", 6242); prop.comment = "The Item ID for Billund order forms"; orderFormItemID = prop.getInt(); // Setup general // None // Save config config.save(); proxy.preLoad(); }
@PreInit public void preInit(FMLPreInitializationEvent event) { logger = Logger.getLogger(ID); logger.setParent(FMLLog.getLogger()); Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); // post_url = config.get(config.CATEGORY_GENERAL, "post_url", // "http://localhost/post/", // "This is the url of which the mod posts updates to.").value; identifier = config.get(config.CATEGORY_GENERAL, "identifier", "commandforwarder", "This string determines the value of the id field in the post request.").value; debug = config.get(Configuration.CATEGORY_GENERAL, "debug", false, "Enable debuging?").getBoolean(true); ConfigCategory cmdcat = config.getCategory("commands"); cmdcat.setComment("This is a list of command=url."); Map<String, Property> cmdmap = cmdcat.getValues(); if (cmdmap.isEmpty()) { config.get("commands", "example", "http://localhost/post/"); } for (Map.Entry i : cmdmap.entrySet()) { String k = (String) i.getKey(); Property v = (Property) i.getValue(); Command cmd = new Command(k, v.value); this.commands.add(cmd); } // public Map<String,Property> getValues() config.save(); logger.info("debug: " + debug); logger.info("identifier: " + identifier); // logger.info("post_url: " + post_url); }
@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 burning EntityLiving, Arrows and Fireballs in milliseconds. The lower the better and costlier."; updateInterval = updateI.getInt(); config.save(); }
public void loadConfiguration() { config.load(); Property blockEngineId = config.get("block", "electricEngine", 765); Property blockPneumaticGeneratorId = config.get("block", "pneumaticGenerator", 766); Property itemHighThroughputPowerPipe = config.get("item", "highThroughputPowerPipe", 22552); Property gregtechRecipes = config.get("recipes", "gregtechRecipes", true); engineId = blockEngineId.getInt(); pneumaticGeneratorId = blockPneumaticGeneratorId.getInt(); highThroughputPowerPipeId = itemHighThroughputPowerPipe.getInt(); gregtechSupport = gregtechRecipes.getBoolean(true); config.save(); }
@PreInit public void preInit(FMLPreInitializationEvent event) { Configuration cfg = new Configuration(event.getSuggestedConfigurationFile()); FMLLog.log(Level.FINE, "PlaceholderBlocks loading config"); try { cfg.load(); ConfigCategory category = cfg.getCategory("Blocks"); for (Map.Entry<String, Property> entry : category.entrySet()) { String key = entry.getKey(); Property property = entry.getValue(); if (property.getString().length() == 0) { // not set continue; } // parse configuration entry AbstractBlock abstractBlock = new AbstractBlock(key, property.getString()); // add to list keyed by block ID List<AbstractBlock> list; if (abstractBlocks.containsKey(abstractBlock.id)) { list = abstractBlocks.get(abstractBlock.id); } else { list = new ArrayList<AbstractBlock>(); } list.add(abstractBlock); abstractBlocks.put(abstractBlock.id, list); } } catch (Exception e) { FMLLog.log(Level.SEVERE, e, "PlaceholderBlocks had a problem loading it's configuration"); } finally { cfg.save(); } }
public static void init(CellariumConfiguration main) { Property reaperHiltId = main.getItem("reaperHilt.id", DefaultProps.REAPER_HILT); reaperHilt = new ReaperHilt(reaperHiltId.getInt()); Property reaperBladeId = main.getItem("repaerBlade.id", DefaultProps.REAPER_BLADE); reaperBlade = new ReaperBlade(reaperBladeId.getInt()); Property theReaperId = main.getItem("theReaper.id", DefaultProps.THE_REAPER); theReaper = new TheReaper(theReaperId.getInt()); Property sorrowfelHiltId = main.getItem("sorrowfelHilt.id", DefaultProps.SORROWFEL_HILT); sorrowfelHilt = new SorrowfelHilt(sorrowfelHiltId.getInt()); Property sorrowfelBladeId = main.getItem("sorrowfelBlade.id", DefaultProps.SORROWFEL_BLADE); sorrowfelBlade = new SorrowfelBlade(sorrowfelBladeId.getInt()); Property sorrowfelId = main.getItem("sorrowfel.id", DefaultProps.SORROWFEL); sorrowfel = new Sorrowfel(sorrowfelId.getInt()); Property bloodAndSorrowId = main.getItem("bloodAndSorrow.id", DefaultProps.BLOOD_AND_SORROW); bloodAndSorrow = new BloodAndSorrow(bloodAndSorrowId.getInt()); Property ingotFrameId = main.getItem("ingotFrame.id", DefaultProps.INGOT_FRAME); ingotFrame = new IngotFrame(ingotFrameId.getInt()); Property tearsIngotId = main.getItem("tearsIngot.id", DefaultProps.TEARS_INGOT); tearsIngot = new TearsIngot(tearsIngotId.getInt()); }
public Property get(String string, String category, int i) { return config.get(category, string, i); }
public Property get(String string, String category, double i) { return config.get(category, string, i); }
public Property get(String string, String category, boolean i) { return config.get(category, string, i); }
public Property get(String string, String category, String i) { return config.get(category, string, i); }
public static void postInit(Configuration physicsRuleConfig) { /* Setup a default value for all blocks */ setupDefaultPhysicsRules(); /* Initialize the physics-rules file */ String cat = "physics"; physicsRuleConfig.addCustomCategoryComment(cat, "All entries in here modify the rules for physics blocks"); /* * For each block, if it exists in the config file use it otherwise add the * default value */ WorkerPhysicsSweep.maxChunkDist = physicsRuleConfig.get(cat, "0-maxDistanceForPhysics", "" + WorkerPhysicsSweep.maxChunkDist, "Radius around player in which physics are computed", Property.Type.INTEGER).getInt(WorkerPhysicsSweep.maxChunkDist); elasticStrengthConstant = physicsRuleConfig.get(cat, "0-elasticStrengthConstant", "" + elasticStrengthConstant, "only change this if you know what you do, it effects the total time before physics kick in", Property.Type.INTEGER).getInt(elasticStrengthConstant); physicsRuleConfig.get(cat, "1-example-do-full", "true", "If true, the full physics is run for this type of blocks, if false the simplified physics may still be applied", Property.Type.BOOLEAN); physicsRuleConfig .get( cat, "1-example-do-simplified", "0", "Integer order of execution of simplified physics. 0 disables simplified physics. Lower numbers can support higher numbers (but never blocks of full-physics). See leaves and vines for example", Property.Type.INTEGER); physicsRuleConfig.get(cat, "1-example-is-rope", "false", "Used only for blocks using simplified physics. Prevents them supporting blocks upwards."); physicsRuleConfig.get(cat, "1-example-is-fragile", "true", "If true, the block will break (like glass) when falling", Property.Type.BOOLEAN); physicsRuleConfig.get(cat, "1-example-strength", "16", "Strength of block, must be less than elasticStrenghtConstant. Typical values 5 - 30 times the weight of the block.", Property.Type.INTEGER); physicsRuleConfig.get(cat, "1-example-weight", "4", "Weight of this block, typical values 1 - 16", Property.Type.INTEGER); physicsRuleConfig.get(cat, "1-example-is-sink", "false", "Sinks for forces that prevents all connected blocks from falling", Property.Type.BOOLEAN); physicsRuleConfig.get(cat, "2-start-of-rules", "", "Here comes the rules for each block in the game", Property.Type.STRING); for (int i = 0; i < 4096; i++) { Block b = Block.blocksList[i]; if (i == 0 || b == null || b.blockID == 0) continue; String name = b.getUnlocalizedName().replace("tile.", ""); if (i == Block.cobblestone.blockID) name = "cobbleStone"; if (i == Block.stoneBrick.blockID) name = "stoneBrick"; SolidBlockPhysicsRules.blockDoPhysics[i] = physicsRuleConfig.get(cat, name + "-do-full", SolidBlockPhysicsRules.blockDoPhysics[i] ? "true" : "false", null, Property.Type.BOOLEAN).getBoolean(SolidBlockPhysicsRules.blockDoPhysics[i]); if (!SolidBlockPhysicsRules.blockDoPhysics[i]) { SolidBlockPhysicsRules.blockDoSimplePhysics[i] = physicsRuleConfig.get(cat, name + "-do-simplified", "" + SolidBlockPhysicsRules.blockDoSimplePhysics[i], null, Property.Type.INTEGER).getInt(SolidBlockPhysicsRules.blockDoSimplePhysics[i]); blockDoRopePhysics[i] = physicsRuleConfig.get(cat, name + "-is-rope", blockDoRopePhysics[i] ? "true" : "false", null, Property.Type.BOOLEAN) .getBoolean(SolidBlockPhysicsRules.blockDoRopePhysics[i]); } if (SolidBlockPhysicsRules.blockDoPhysics[i] || SolidBlockPhysicsRules.blockDoSimplePhysics[i] != 0) { blockIsFragile[i] = physicsRuleConfig.get(cat, name + "-is-fragile", blockIsFragile[i] ? "true" : "false", null, Property.Type.BOOLEAN).getBoolean( blockIsFragile[i]); blockStrength[i] = physicsRuleConfig.get(cat, name + "-strength", "" + blockStrength[i], null, Property.Type.INTEGER).getInt(blockStrength[i]); blockWeight[i] = physicsRuleConfig.get(cat, name + "-weight", "" + blockWeight[i], null, Property.Type.INTEGER).getInt(blockWeight[i]); blockIsSink[i] = physicsRuleConfig.get(cat, name + "-is-sink", blockIsSink[i] ? "true" : "false", null, Property.Type.BOOLEAN).getBoolean( SolidBlockPhysicsRules.blockDoPhysics[i]); } } blockIsSink[FysiksFun.settings.blockSupportBlockDefaultID] = true; }
public ConfigHandler(File configFile){ // Loads The Configuration File into Forges Configuration Configuration conf = new Configuration(configFile); try{ conf.load(); // Misc mod settings Property IdeaChanceRate = conf.get("Settings", "IdeaRate", 35); IdeaChanceRate.comment = "The chance of you getting an idea from crafting (fx. 1 in a 100)"; ideaChance = IdeaChanceRate.getInt(); Property GenOreTin = conf.get("Settings", "GenOreTin", true); GenOreTin.comment = "Should the mod generate tin"; genOreTin = GenOreTin.getBoolean(true); Property GenOreCopper = conf.get("Settings", "GenOreCopper", true); GenOreCopper.comment = "Should the mod generate copper"; genOreCopper = GenOreCopper.getBoolean(true); // Load Block Ids Property blockOre = conf.getBlock("OreBlocks", blockRange); blockOre.comment = "Ore Block ID, this includes Tin, Copper and Others"; IDOreBlock = blockOre.getInt(); Property blockWorkstation = conf.getBlock("Workstation", blockRange+1); blockWorkstation.comment = "The workstation where you refine your ideas and craft items"; IDWorkstation = blockWorkstation.getInt(); Property blockIdeaBuilder = conf.getBlock("IdeaBuilder", blockRange+2); blockIdeaBuilder.comment = "This is the extension too the workstation that lets you craft what you think off."; IDIdeaBuilder = blockIdeaBuilder.getInt(); Property blockCraftingTable = conf.getBlock("CraftingTable", blockRange+3); blockCraftingTable.comment = "This is a vanilla crafting table extention too the workstation, will keep inventory on gui close !"; IDCraftingTable = blockCraftingTable.getInt(); Property blockIdeaBlocks = conf.getBlock("IdeaBlocks", blockRange+4); blockIdeaBlocks.comment = "These are the blocks you can build from your ideas"; IDIdeaBlocks = blockIdeaBlocks.getInt(); // Load Item Ids Property itemIdea = conf.getItem("Idea", itemRange); itemIdea.comment = "The idea paper that falls on the ground"; IDIdeaItem = itemIdea.getInt(); Property itemBookOfWondering = conf.getItem("BookOfWondering", itemRange+1); itemBookOfWondering.comment = "The Book of Wondering, for you too store your ideas"; IDWonderingBook = itemBookOfWondering.getInt(); Property itemPencil = conf.getItem("Pencil", itemRange+2); itemPencil.comment = "Pencil is an idea you have for editing signs"; IDPencil = itemPencil.getInt(); Property itemResource = conf.getItem("ItemResources", itemRange+3); itemResource.comment = "Item resources like copper and tin ingots"; IDResource = itemResource.getInt(); Property itemMinersHelm = conf.getItem("MinersHelmet", itemRange+4); itemMinersHelm.comment = "Helmet you put on for minging"; IDMinersHelmet = itemMinersHelm.getInt(); }catch(RuntimeException e){ MineTechPlus.instance.log.log(Level.INFO, "Config file not found, creating new one"); }finally{ conf.save(); } }
@Override public void save() { Property versionProp = get(CATEGORY_GENERAL, "version", Constants.VERSION); versionProp.set(Constants.VERSION); super.save(); }
@Override public boolean onConfigChange(Config cfg, Property prop) { return true; }
@Init public void load(FMLInitializationEvent event) { proxy.registerRenderers(); config.load(); config.addCustomCategoryComment(ConfigCategory_Generic, "All generic settings for questcraft"); config.addCustomCategoryComment( ConfigCategory_Blocks, "Rules for all blocks that should be affected by this.\n" + "All rules have a name of Bi_xyz where i is an integer counting up from 0.\n" + "Each rule has to have a name _Name (eg. B42_Name) that is a regular expression for matching blocks to the rule.\n" + "Additional information for the rules include any of the following:\n" + " _MetaData: overrides the metadata to give to the block when it pops\n" + " _StackSize: overrides the maximum allowed stacksize for blockitems matching the rule\n"); Property defaultMetaDataProp = config.get(ConfigCategory_Generic, "defaultMetaData", "-1"); defaultMetaDataProp.comment = "The meta value to assign blocks that a placed back in world." + "Default -1 uses the same as from the given item ID." + "255 is needed for blocks with dual states in the BlockPhysics mod"; defaultMetaData = defaultMetaDataProp.getInt(-1); Property printBlockItemInfoProp = config.get(ConfigCategory_Generic, "printBlockInfo", "false"); printBlockItemInfoProp.comment = "Print a chat message whenver a blockitem is picked up with the corresponding name of the block used for making rules. Default false"; printBlockItemInfo = printBlockItemInfoProp.getBoolean(false); Property defaultStackSizeProp = config.get(ConfigCategory_Generic, "defaultStackSize", "1"); defaultStackSizeProp.comment = "The default maximum size of any of the stacks that are listen in the blocks section, may be overridden for individual blocks"; defaultStackSize = defaultStackSizeProp.getInt(1); Property defaultMinPopTimeProp = config.get(ConfigCategory_Generic, "defaultMinPopTime", "20"); defaultMinPopTimeProp.comment = "The default minimum time (in ticks) before an itemstack matched by the rules will pop-out to become a block"; defaultMinPopTime = defaultMinPopTimeProp.getInt(20); Property defaultMaxPopTimeProp = config.get(ConfigCategory_Generic, "defaultMaxPopTime", "20"); defaultMaxPopTimeProp.comment = "The default minimum time (in ticks) before an itemstack matched by the rules will pop-out to become a block"; defaultMaxPopTime = defaultMaxPopTimeProp.getInt(20); for(nRules=0;nRules<256;) { Property nameProp = config.get(ConfigCategory_Blocks, "B" + nRules + "_Name", ""); Property metaDataProp = config.get(ConfigCategory_Blocks, "B" + nRules + "_MetaData", ""); Property stackSizeProp = config.get(ConfigCategory_Blocks, "B" + nRules + "_MaxStackSize", ""); Property minPopTimeProp = config.get(ConfigCategory_Blocks, "B" + nRules + "_MinPopTime", ""); Property maxPopTimeProp = config.get(ConfigCategory_Blocks, "B" + nRules + "_MaxPopTime", ""); if (nameProp == null || nameProp.value.equals("")) break; Rule r = new Rule(); r.blockName = nameProp.value; if(metaDataProp.value == "") r.metaData = -2; else r.metaData = metaDataProp.getInt(-2); if(stackSizeProp.value == "") r.stackSize = -2; else r.stackSize = stackSizeProp.getInt(-2); if(minPopTimeProp.value == "") r.minPopTime = -2; else r.minPopTime = minPopTimeProp.getInt(-2); if(maxPopTimeProp.value == "") r.maxPopTime = -2; else r.maxPopTime = maxPopTimeProp.getInt(-2); rules[nRules++] = r; } System.out.println("Finished loading settings, "+nRules+" rules found"); config.save(); eventListener = new EventListener(); MinecraftForge.EVENT_BUS.register(eventListener); }
@PreInit public static void preInit(FMLPreInitializationEvent event) { oreName2PreferredMod = new HashMap<String, String>(); Configuration cfg = new Configuration(event.getSuggestedConfigurationFile()); FMLLog.log(Level.FINE, "OreDupeFix loading config"); try { cfg.load(); if (cfg.getCategoryNames().size() == 0) { loadDefaults(cfg); } ConfigCategory category = cfg.getCategory("PreferredOres"); for (Map.Entry<String, Property> entry : category.entrySet()) { String name = entry.getKey(); Property property = entry.getValue(); if (property.getString().length() == 0) { // not set continue; } oreName2PreferredMod.put(name, property.getString()); } shouldDumpOreDict = cfg.get(Configuration.CATEGORY_GENERAL, "dumpOreDict", true).getBoolean(true); verbose = cfg.get(Configuration.CATEGORY_GENERAL, "verbose", true).getBoolean(true); // TODO: refactor replaceCrafting = cfg.get(Configuration.CATEGORY_GENERAL, "replaceCrafting", true).getBoolean(true); replaceFurnace = cfg.get(Configuration.CATEGORY_GENERAL, "replaceFurnace", true).getBoolean(true); replaceFurnaceInsensitive = cfg.get(Configuration.CATEGORY_GENERAL, "replaceFurnaceInsensitive", true).getBoolean(true); replaceDungeonLoot = cfg.get(Configuration.CATEGORY_GENERAL, "replaceDungeonLoot", true).getBoolean(true); replaceIC2Compressor = cfg.get(Configuration.CATEGORY_GENERAL, "replaceIC2Compressor", true).getBoolean(true); replaceIC2Extractor = cfg.get(Configuration.CATEGORY_GENERAL, "replaceIC2Extractor", true).getBoolean(true); replaceIC2Macerator = cfg.get(Configuration.CATEGORY_GENERAL, "replaceIC2Macerator", true).getBoolean(true); replaceIC2Scrapbox = cfg.get(Configuration.CATEGORY_GENERAL, "replaceIC2Scrapbox", true).getBoolean(true); } catch (Exception e) { FMLLog.log(Level.SEVERE, e, "OreDupeFix had a problem loading it's configuration"); } finally { cfg.save(); } }
@PreInit public void initConfig(FMLPreInitializationEvent fpe) { Fuel.init(); Configuration config = new Configuration(fpe.getSuggestedConfigurationFile()); config.load(); int firstBlockId = config.getBlock("StartBlockId", 3700).getInt(); startBlockID = firstBlockId; upgradIds = config.getItem("Start Upgrad ID", 17000).getInt(); int randomItemID = config.getItem("StartItemId", 15000).getInt(); bulletid = randomItemID; int entityid = config.get("EntityId", "EntityId", 400).getInt(); startEntityId = entityid; // Since this flag is a boolean, we can read it into the variable directly from the config. explosions = config.get(Configuration.CATEGORY_GENERAL, "Explosions", false).getBoolean(false); //Notice there is nothing that gets the value of this property so the expression results in a Property object. Property someProperty = config.get(Configuration.CATEGORY_GENERAL, "SomeConfigString", "nothing"); // Here we add a comment to our new property. someProperty.comment = "This value can be read as a string!"; // this could also be: // int someInt = someProperty.getInt(); // boolean someBoolean = someProperty.getBoolean(true); config.save(); int speacalblockid = startBlockID + 50; weaponCarver = (new BlockWeaponCarver(startBlockID)); death = (new BlockDeath(startBlockID + 1)); projetor = (new BlockProjetor(startBlockID + 2)); sicurityStorage = (new BlockSicurityStorage(startBlockID + 3)); powerStorage = (new BlockPowerStorage(startBlockID + 4)); upgator = (new BlockUpgrator(startBlockID + 5)); random = (new BlockRandom(startBlockID + 6)); antiMaterGenerator1 = (new BlockAntiMaterGenerator(speacalblockid, 1)); antiMaterGenerator2 = (new BlockAntiMaterGenerator(speacalblockid + 1, 2)); antiMaterGenerator3 = (new BlockAntiMaterGenerator(speacalblockid + 2, 3)); antiMaterGenerator4 = (new BlockAntiMaterGenerator(speacalblockid + 3, 4)); antiMaterGenerator5 = (new BlockAntiMaterGenerator(speacalblockid + 4, 5)); antiMaterGenerator6 = (new BlockAntiMaterGenerator(speacalblockid + 5, 6)); antiMaterGenerator7 = (new BlockAntiMaterGenerator(speacalblockid + 6, 7)); antiMaterGenerator8 = (new BlockAntiMaterGenerator(speacalblockid + 7, 8)); antiMaterGenerator9 = (new BlockAntiMaterGenerator(speacalblockid + 8, 9)); antiMaterGenerator10 = (new BlockAntiMaterGenerator(speacalblockid + 9, 10)); antiMaterGenerator11 = (new BlockAntiMaterGenerator(speacalblockid + 10, 11)); antiMaterGenerator12 = (new BlockAntiMaterGenerator(speacalblockid + 11, 12)); antiMaterGenerator13 = (new BlockAntiMaterGenerator(speacalblockid + 12, 13)); antiMaterGenerator14 = (new BlockAntiMaterGenerator(speacalblockid + 13, 14)); antiMaterGenerator15 = (new BlockAntiMaterGenerator(speacalblockid + 14, 15)); antiMaterGenerator16 = (new BlockAntiMaterGenerator(speacalblockid + 15, 16)); antiMaterGenerator17 = (new BlockAntiMaterGenerator(speacalblockid + 16, 17)); antiMaterGenerator18 = (new BlockAntiMaterGenerator(speacalblockid + 17, 18)); antiMaterGenerator19 = (new BlockAntiMaterGenerator(speacalblockid + 18, 19)); antiMaterGenerator20 = (new BlockAntiMaterGenerator(speacalblockid + 19, 20)); antiMaterGenerator21 = (new BlockAntiMaterGenerator(speacalblockid + 20, 21)); antiMaterGenerator22 = (new BlockAntiMaterGenerator(speacalblockid + 21, 22)); antiMaterGenerator23 = (new BlockAntiMaterGenerator(speacalblockid + 22, 23)); antiMaterGenerator24 = (new BlockAntiMaterGenerator(speacalblockid + 23, 24)); antiMaterGenerator25 = (new BlockAntiMaterGenerator(speacalblockid + 24, 25)); antiMaterGenerator26 = (new BlockAntiMaterGenerator(speacalblockid + 25, 26)); antiMaterGenerator27 = (new BlockAntiMaterGenerator(speacalblockid + 26, 27)); GameRegistry.registerBlock(weaponCarver, "WeaponCarver"); GameRegistry.registerBlock(death, "Death"); GameRegistry.registerBlock(projetor, "Projetor"); GameRegistry.registerBlock(sicurityStorage, "SicurityStorage"); GameRegistry.registerBlock(powerStorage, "PowerStorage"); proxy.serverInit(); proxy.registerKeyBindingHandler(); }
public Property getElement(String key, int defaultID) { return this.getBlock("Element", key, defaultID, null); }
public Property getElement(String key, int defaultID, String comment) { return this.getBlock("Element", key, defaultID, comment); }
public Property getOre(String key, int defaultID) { return this.getBlock("Ore", key, defaultID, null); }
public Property getOre(String key, int defaultID, String comment) { return this.getBlock("Ore", key, defaultID, comment); }
public Property getIngot(String key, int defaultID) { return this.getItem("Ingot", key, defaultID, null); }
public Property getIngot(String key, int defaultID, String comment) { return this.getItem("Ingot", key, defaultID, comment); }
public Property getArmor(String key, int defaultID) { return this.getItem("Armor", key, defaultID, null); }
public Property getArmor(String key, int defaultID, String comment) { return this.getItem("Armor", key, defaultID, comment); }
public ConfigHandler(File configFile){ // Loads The Configuration File into Forges Configuration Configuration conf = new Configuration(configFile); try{ conf.load(); Property GenOreTin = conf.get("Settings", "GenOreTin", true); GenOreTin.comment = "Should the mod generate tin"; genOreTin = GenOreTin.getBoolean(true); Property GenOreCopper = conf.get("Settings", "GenOreCopper", true); GenOreCopper.comment = "Should the mod generate copper"; genOreCopper = GenOreCopper.getBoolean(true); Property blockOre = conf.getBlock("OreBlocks", blockRange); blockOre.comment = "Ore Block ID(Tin, Copper and Others)"; IDOreBlock = blockOre.getInt(); Property itemBlasterRifle = conf.getItem("BlasterRifle", itemRange); itemBlasterRifle.comment = "Grosse Waffe^"; IDBlasterRifle = itemBlasterRifle.getInt(); Property itemRedstoneBattery = conf.getItem("RedstoneBattery", itemRange+1); itemRedstoneBattery.comment = "Magazin fuer Waffe"; IDRedstoneBattery = itemRedstoneBattery.getInt(); Property itemResource = conf.getItem("ItemResources", itemRange+3); itemResource.comment = "copper and tin ingots"; IDResource = itemResource.getInt(); }catch(RuntimeException e){ MOF.instance.log.log(Level.INFO, "Config file not found, creating new one"); }finally{ conf.save(); } }