Package net.minecraftforge.common

Examples of net.minecraftforge.common.Configuration


    TickRegistry.registerScheduledTickHandler(new UpdateManager(this), Side.CLIENT);
  }
 
  private void loadConfig(File f)
  {
    Configuration c = new Configuration(f);
    c.load();
   
    doUpdateCheck = c.get(Configuration.CATEGORY_GENERAL, "EnableUpdateCheck", true);
    doUpdateCheck.comment = "Set to false to disable update checks for all Power Crystals' mods.";
   
    c.save();
  }
View Full Code Here


  {
    NetworkRegistry.instance().registerGuiHandler(this, proxy);
    instance = this;

    // Config
    Configuration config = new Configuration(event.getSuggestedConfigurationFile());
    config.load();

    // Items
    for (ItemEnum current : ItemEnum.values())
    {
      current.setID(config.getItem(current.getIDName() + "_ID", current.getID(), current.getDescription()).getInt());
    }

    // Blocks
    for (BlockEnum current : BlockEnum.values())
    {
      current.setID(config.getBlock(current.getIDName() + "_ID", current.getID(), current.getDescription()).getInt());
    }

    // Tick Rates
    tickRateExport = config.get("Tick Rates", "tickRateExportBus", 20, "Every x ticks the export bus ticks. mb/t get adjusted automatically ;)").getInt();
    tickRateImport = config.get("Tick Rates", "tickRateImportBus", 20, "Every x ticks the import bus ticks. mb/t get adjusted automatically ;)").getInt();
    tickRateStorage = config.get("Tick Rates", "tickRateStorageBus", 20, "Every x ticks the storage bus ticks. mb/t get adjusted automatically ;)").getInt();
    tickRateChamber = config.get("Tick Rates", "tickRateCraftingChamber", 20, "Every x ticks the crafting chamber  ticks. mb/t get adjusted automatically ;)").getInt();

    // Fluid Mode Settings
    WidgetFluidModes.FluidMode.DROPS.setAmount(config.get("Fluid Rates", "rateDrop", 20, "The Amount of Fluid being filled/drained per tick on the \"Drop\"-Amount").getInt());
    WidgetFluidModes.FluidMode.QUART.setAmount(config.get("Fluid Rates", "rateQuart", 250, "The Amount of Fluid being filled/drained per tick on the \"Quart\"-Amount").getInt());
    WidgetFluidModes.FluidMode.BUCKETS.setAmount(config.get("Fluid Rates", "rateBucket", 1000, "The Amount of Fluid being filled/drained per tick on the \"Bucket\"-Amount").getInt());
    WidgetFluidModes.FluidMode.DROPS.setCost(config.get("Energy Rates", "rateDrop", 5.0D, "The Energy Cost per fill/drain operation on the \"Drop\"-Amount").getDouble(5.0D));
    WidgetFluidModes.FluidMode.QUART.setCost(config.get("Energy Rates", "rateQuart", 30.0D, "The Energy Cost per fill/drain operation on the \"Quart\"-Amount").getDouble(30.0D));
    WidgetFluidModes.FluidMode.BUCKETS.setCost(config.get("Energy Rates", "rateBucket", 60.0D, "The Energy Cost per fill/drain operation on the \"Bucket\"-Amount").getDouble(60.0D));

    if (tickRateExport <= 0)
      tickRateExport = 20;
    if (tickRateImport <= 0)
      tickRateImport = 20;
    if (tickRateStorage <= 0)
      tickRateStorage = 20;

    debug = config.get("Dev Options", "showFluidsInMETerminal", false, "Dont't activate if you dont want to debug stuff ;)").getBoolean(false);
    shortenedBuckets = config.get("Render Options", "shortenBucketsInTerminal", true, "Do you want to show 1kB or 1000000mB?").getBoolean(true);
    config.save();
  }
View Full Code Here

public class ConfigurationManager {

  private static Configuration config;

  public static void loadConfiguration(File configFile) {
    config = new Configuration( configFile );
    config.load();

    machineID = config.getBlock( "machineID", 3919 ).getInt();
    blankChipID = config.getItem( "blankChip", 9100 ).getInt();
    encodedChipID = config.getItem( "encodedChip", 9101 ).getInt();
View Full Code Here

  public static void preInit(FMLPreInitializationEvent event)
  {
    Info.isDebugging = false;
    try
    {
      Configuration configuration = new Configuration(event.getSuggestedConfigurationFile());
      configuration.load();

      // Check for legacy configuration file
      File oldFile = new File(event.getModConfigurationDirectory(), "ChargingBench.cfg");
      boolean migrate = oldFile.exists();
      if (migrate)
      {
        FMLLog.getLogger().info(Info.TITLE_LOG + "Discovered old config file: " + oldFile + " - Attempting to migrate block and item IDs.");
        if (configuration.hasKey("block", "AdvPowerManBlock"))
        {
          FMLLog.getLogger().info(Info.TITLE_LOG + "New config file already contains settings. Skipping migration.");
        }
        else
        {
          Configuration oldconfig = new Configuration(oldFile);
          oldconfig.load();
          blockIDAdvPwrMan = oldconfig.get(configuration.CATEGORY_BLOCK, "ChargingBench", blockIDAdvPwrMan).getInt();
          Info.isDebugging = (oldconfig.get(configuration.CATEGORY_GENERAL, "debug",  Info.isDebugging).getBoolean(Info.isDebugging));
          oldconfig.save();
          boolean success = oldFile.delete();
          if (success)
          {
            FMLLog.getLogger().info(Info.TITLE_LOG + "Done with old config file.");
          }
View Full Code Here

  public static Property thermalExpansionRecipes;
  public static Property gregTechRecipes;
 
  public static void loadClientConfig(File configFile)
  {
    Configuration c = new Configuration(configFile);
   
    spyglassRange = c.get(Configuration.CATEGORY_GENERAL, "SpyglassRange", 200);
    spyglassRange.comment = "The maximum number of blocks the spyglass and ruler can look to find something. This calculation is performed only on the client side.";
   
    c.save();
  }
View Full Code Here

    c.save();
  }
 
  public static void loadCommonConfig(File configFile)
  {
    Configuration c = new Configuration(configFile);
    c.load();
    machineBlock0Id = c.getBlock("ID.MachineBlock", 3120);
    conveyorBlockId = c.getBlock("ID.ConveyorBlock", 3121);
    rubberWoodBlockId = c.getBlock("ID.RubberWood", 3122);
    rubberLeavesBlockId = c.getBlock("ID.RubberLeaves", 3123);
    rubberSaplingBlockId = c.getBlock("ID.RubberSapling", 3124);
    railDropoffCargoBlockId = c.getBlock("ID.CargoRailDropoffBlock", 3125);
    railPickupCargoBlockId = c.getBlock("ID.CargoRailPickupBlock", 3126);
    railDropoffPassengerBlockId = c.getBlock("ID.PassengerRailDropoffBlock", 3127);
    railPickupPassengerBlockId = c.getBlock("ID.PassengerRailPickupBlock", 3128);
    factoryGlassBlockId = c.getBlock("ID.StainedGlass", 3129);
    factoryGlassPaneBlockId = c.getBlock("ID.StainedGlassPane", 3130);
    machineBlock1Id = c.getBlock("ID.MachineBlock1", 3131);
    factoryRoadBlockId = c.getBlock("ID.Road", 3132);
    factoryDecorativeBrickBlockId = c.getBlock("ID.Bricks", 3133);
    factoryDecorativeStoneBlockId = c.getBlock("ID.Stone", 3134);
    milkStillBlockId = c.getBlock("ID.Milk.Still", 3135);
    meatStillBlockId = c.getBlock("ID.Meat.Still", 3136);
    sludgeStillBlockId = c.getBlock("ID.Sludge.Still", 3137);
    pinkslimeStillBlockId = c.getBlock("ID.PinkSlime.Still", 3138);
    sewageStillBlockId = c.getBlock("ID.Sewage.Still", 3139);
    chocolateMilkStillBlockId = c.getBlock("ID.ChocolateMilk.Still", 3140);
    essenceStillBlockId = c.getBlock("ID.MobEssence.Still", 3141);
    mushroomSoupStillBlockId = c.getBlock("ID.MushroomSoup.Still", 3142);
    biofuelStillBlockId = c.getBlock("ID.BioFuel.Still", 3143);
    rednetCableBlockId = c.getBlock("ID.RedNet.Cable", 3144);
    rednetLogicBlockId = c.getBlock("ID.RedNet.Logic", 3145);
    machineBlock2Id = c.getBlock("ID.MachineBlock2", 3146);
    fakeLaserBlockId = c.getBlock("ID.FakeLaser", 3147);
    vineScaffoldBlockId = c.getBlock("ID.VineScaffold", 3148);
    rednetPanelBlockId = c.getBlock("ID.RedNet.Panel", 3149);
   
    hammerItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.Hammer", 11987);
    milkItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.Milk", 11988);
    sludgeItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.Sludge", 11989);
    sewageItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.Sewage", 11990);
    mobEssenceItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.MobEssence", 11991);
    fertilizerItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.FertilizerItem", 11992);
    plasticSheetItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.PlasticSheet", 11993);
    rawPlasticItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.RawPlastic", 11994);
    rubberBarItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.RubberBar", 11995);
    sewageBucketItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.SewageBucket", 11996);
    sludgeBucketItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.SludgeBucket", 11997);
    mobEssenceBucketItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.MobEssenceBucket", 11998);
    syringeEmptyItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.SyringeEmpty", 11999);
    syringeHealthItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.SyringeHealth", 12000);
    syringeGrowthItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.SyringeGrowth", 12001);
    rawRubberItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.RawRubber", 12002);
    machineBaseItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.MachineBlock", 12003);
    safariNetItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.SafariNet", 12004);
    ceramicDyeItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.CeramicDye", 12005);
    blankRecordId = c.getItem(Configuration.CATEGORY_ITEM, "ID.BlankRecord", 12006);
    syringeZombieId = c.getItem(Configuration.CATEGORY_ITEM, "ID.SyringeZombie", 12007);
    safariNetSingleItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.SafariNetSingleUse", 12008);
    bioFuelItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.BioFuel", 12009);
    bioFuelBucketItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.BioFuelBucket", 12010);
    upgradeItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.Upgrade", 12011);
    safariNetLauncherItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.SafariNetLauncher", 12012);
    sugarCharcoalItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.SugarCharcoal", 12013);
    milkBottleItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.MilkBottle", 12014);
    spyglassItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.Spyglass", 12015);
    portaSpawnerItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.PortaSpawner", 12016);
    strawItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.Straw", 12017);
    xpExtractorItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.XPExtractor", 12018);
    syringeSlimeItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.SyringeSlime", 12019);
    syringeCureItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.SyringeCure", 12020);
    logicCardItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.Upgrade.PRC", 12021);
    rednetMeterItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.RedNet.Meter", 12022);
    rednetMemoryCardItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.RedNet.MemoryCard", 12023);
    rulerItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.Ruler", 12024);
    meatIngotRawItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.MeatIngotRaw", 12025);
    meatIngotCookedItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.MeatIngotCooked", 12026);
    meatNuggetRawItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.MeatNuggetRaw", 12027);
    meatNuggetCookedItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.MeatNuggetCooked", 12028);
    meatBucketItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.MeatBucket", 12029);
    pinkSlimeBucketItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.PinkSlimeBucket", 12030);
    pinkSlimeballItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.PinkSlimeball", 12031);
    safariNetJailerItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.SafariNetJailer", 12032);
    laserFocusItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.LaserFocus", 12033);
    chocolateMilkBucketItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.ChocolateMilkBucket", 12034);
    mushroomSoupBucketItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.MushroomSoupBucket", 12035);
    needlegunItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.NeedleGun", 12036);
    needlegunAmmoEmptyItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.NeedleGun.Ammo.Empty", 12037);
    needlegunAmmoStandardItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.NeedleGun.Ammo.Standard", 12038);
    needlegunAmmoLavaItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.NeedleGun.Ammo.Lava", 12039);
    needlegunAmmoSludgeItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.NeedleGun.Ammo.Sludge", 12040);
    needlegunAmmoSewageItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.NeedleGun.Ammo.Sewage", 12041);
    needlegunAmmoFireItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.NeedleGun.Ammo.Fire", 12042);
    needlegunAmmoAnvilItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.NeedleGun.Ammo.Anvil", 12043);
    plasticCupItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.PlasticCup", 12044);
    rocketLauncherItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.RocketLauncher", 12045);
    rocketItemId = c.getItem(Configuration.CATEGORY_ITEM, "ID.Rocket", 12046);
   
    zoolologistEntityId = c.get("Entity", "ID.Zoologist", 330);
   
    colorblindMode = c.get(Configuration.CATEGORY_GENERAL, "RedNet.EnableColorblindMode", false);
    colorblindMode.comment = "Set to true to enable the RedNet GUI's colorblind mode.";
    treeSearchMaxHorizontal = c.get(Configuration.CATEGORY_GENERAL, "SearchDistance.TreeMaxHoriztonal", 8);
    treeSearchMaxHorizontal.comment = "When searching for parts of a tree, how far out to the sides (radius) to search";
    treeSearchMaxVertical = c.get(Configuration.CATEGORY_GENERAL, "SearchDistance.TreeMaxVertical", 40);
    treeSearchMaxVertical.comment = "When searching for parts of a tree, how far up to search";
    verticalHarvestSearchMaxVertical = c.get(Configuration.CATEGORY_GENERAL, "SearchDistance.StackingBlockMaxVertical", 3);
    verticalHarvestSearchMaxVertical.comment = "How far upward to search for members of \"stacking\" blocks, like cactus and sugarcane";
    passengerRailSearchMaxVertical = c.get(Configuration.CATEGORY_GENERAL, "SearchDistance.PassengerRailMaxVertical", 2);
    passengerRailSearchMaxVertical.comment = "When searching for players or dropoff locations, how far up to search";
    passengerRailSearchMaxHorizontal = c.get(Configuration.CATEGORY_GENERAL, "SearchDistance.PassengerRailMaxHorizontal", 3);
    passengerRailSearchMaxHorizontal.comment = "When searching for players or dropoff locations, how far out to the sides (radius) to search";
    rubberTreeWorldGen = c.get(Configuration.CATEGORY_GENERAL, "WorldGen.RubberTree", true);
    rubberTreeWorldGen.comment = "Whether or not to generate rubber trees during map generation";
    mfrLakeWorldGen = c.get(Configuration.CATEGORY_GENERAL, "WorldGen.MFRLakes", true);
    mfrLakeWorldGen.comment = "Whether or not to generate MFR lakes during map generation";
    enableBonemealFertilizing = c.get(Configuration.CATEGORY_GENERAL, "Fertilizer.EnableBonemeal", false);
    enableBonemealFertilizing.comment = "If true, the fertilizer will use bonemeal as well as MFR fertilizer. Provided for those who want a less work-intensive farm.";
    enableCheapDSU = c.get(Configuration.CATEGORY_GENERAL, "DSU.EnableCheaperRecipe", false);
    enableCheapDSU.comment = "If true, DSU can be built out of chests instead of ender pearls. Does nothing if the DSU recipe is disabled.";
    craftSingleDSU = c.get(Configuration.CATEGORY_GENERAL, "DSU.CraftSingle", false);
    craftSingleDSU.comment = "DSU recipes will always craft one DSU. Does nothing for recipes that already only craft one DSU (cheap mode, GT recipes, etc).";
    enableMossyCobbleRecipe = c.get(Configuration.CATEGORY_GENERAL, "EnableMossyCobbleRecipe", true);
    enableMossyCobbleRecipe.comment = "If true, mossy cobble can be crafted.";
    conveyorCaptureNonItems = c.get(Configuration.CATEGORY_GENERAL, "Conveyor.CaptureNonItems", true);
    conveyorCaptureNonItems.comment = "If false, conveyors will not grab non-item entities. Breaks conveyor mob grinders but makes them safe for golems, etc.";
    conveyorNeverCapturesPlayers = c.get(Configuration.CATEGORY_GENERAL, "Conveyor.NeverCapturePlayers", false);
    conveyorNeverCapturesPlayers.comment = "If true, conveyors will NEVER capture players regardless of other settings.";
    conveyorNeverCapturesTCGolems = c.get(Configuration.CATEGORY_GENERAL, "Conveyor.NeverCaptureTCGolems", false);
    conveyorNeverCapturesTCGolems.comment = "If true, conveyors will NEVER capture Thaumcraft golems regardless of other settings.";
    playSounds = c.get(Configuration.CATEGORY_GENERAL, "PlaySounds", true);
    playSounds.comment = "Set to false to disable the harvester's sound when a block is harvested.";
    enableSlipperyRoads = c.get(Configuration.CATEGORY_GENERAL, "Road.Slippery", true);
    enableSlipperyRoads.comment = "If true, roads will be slippery like ice.";
    fruitTreeSearchMaxHorizontal = c.get(Configuration.CATEGORY_GENERAL, "SearchDistance.FruitTreeMaxHoriztonal", 5);
    fruitTreeSearchMaxHorizontal.comment = "When searching for parts of a fruit tree, how far out to the sides (radius) to search";
    fruitTreeSearchMaxVertical = c.get(Configuration.CATEGORY_GENERAL, "SearchDistance.FruitTreeMaxVertical", 20);
    fruitTreeSearchMaxVertical.comment = "When searching for parts of a fruit tree, how far up to search";
    breederShutdownThreshold = c.get(Configuration.CATEGORY_GENERAL, "Breeder.ShutdownThreshold", 50);
    breederShutdownThreshold.comment = "If the number of entities in the breeder's target area exceeds this value, the breeder will cease operating. This is provided to control server lag.";
    autospawnerCostExact = c.get(Configuration.CATEGORY_GENERAL, "AutoSpawner.Cost.Exact", 50);
    autospawnerCostExact.comment = "The work required to generate a mob in exact mode.";
    autospawnerCostStandard = c.get(Configuration.CATEGORY_GENERAL, "AutoSpawner.Cost.Standard", 15);
    autospawnerCostStandard.comment = "The work required to generate a mob in standard (non-exact) mode.";
    laserdrillCost = c.get(Configuration.CATEGORY_GENERAL, "LaserDrill.Cost", 300);
    laserdrillCost.comment = "The work required by the drill to generate a single ore.";
    meatSaturation = c.get(Configuration.CATEGORY_GENERAL, "Meat.IncreasedSaturation", false);
    meatSaturation.comment = "If true, meat will be worth steak saturation instead of cookie saturation.";
   
    vanillaOverrideGlassPane = c.get(Configuration.CATEGORY_GENERAL, "VanillaOverride.GlassPanes", true);
    vanillaOverrideGlassPane.comment = "If true, allows vanilla glass panes to connect to MFR stained glass panes.";
    vanillaOverrideIce = c.get(Configuration.CATEGORY_GENERAL, "VanillaOverride.Ice", true);
    vanillaOverrideIce.comment = "If true, enables MFR unmelting ice as well as vanilla ice.";
    vanillaOverrideMilkBucket = c.get(Configuration.CATEGORY_GENERAL, "VanillaOverride.MilkBucket", true);
    vanillaOverrideMilkBucket.comment = "If true, replaces the vanilla milk bucket so milk can be placed in the world.";
   
    enableCompatibleAutoEnchanter = c.get(Configuration.CATEGORY_GENERAL, "AutoEnchanter.EnableSafeMode", false);
    enableCompatibleAutoEnchanter.comment = "This was provided to workaround a BuildCraft issue in 1.4 and no longer has any effect.";
   
    redNetDebug = c.get(Configuration.CATEGORY_GENERAL, "RedNet.Debug", false);
    redNetDebug.comment = "If true, RedNet cables will dump a massive amount of data to the log file. You should probably only use this if PC tells you to.";
   
    rubberTreeBiomeWhitelist = c.get(Configuration.CATEGORY_GENERAL, "WorldGen.RubberTreeBiomeWhitelist", "");
    rubberTreeBiomeWhitelist.comment = "A comma-separated list of biomes to allow rubber trees to spawn in. Does nothing if rubber tree worldgen is disabled.";
    rubberTreeBiomeBlacklist = c.get(Configuration.CATEGORY_GENERAL, "WorldGen.RubberTreeBiomeBlacklist", "");
    rubberTreeBiomeBlacklist.comment = "A comma-separated list of biomes to disallow rubber trees to spawn in. Overrides any other biomes added.";
    redNetConnectionBlacklist = c.get(Configuration.CATEGORY_GENERAL, "RedNet.ConnectionBlackList", "");
    redNetConnectionBlacklist.comment = "A comma-separated list of block IDs to prevent RedNet cables from connecting to.";
    worldGenDimensionBlacklist = c.get(Configuration.CATEGORY_GENERAL, "WorldGen.DimensionBlacklist", "");
    worldGenDimensionBlacklist.comment = "A comma-separated list of dimension IDs to disable MFR worldgen in. By default, MFR will not attempt worldgen in dimensions where the player cannot respawn.";
    mfrLakeSludgeRarity = c.get(Configuration.CATEGORY_GENERAL, "WorldGen.LakeRarity.Sludge", 32);
    mfrLakeSludgeRarity.comment = "Higher numbers make sludge lakes rarer. A value of one will be approximately one per chunk.";
    mfrLakeSewageRarity = c.get(Configuration.CATEGORY_GENERAL, "WorldGen.LakeRarity.Sewage", 32);
    mfrLakeSewageRarity.comment = "Higher numbers make sewage lakes rarer. A value of one will be approximately one per chunk.";
   
    vanillaRecipes = c.get("RecipeSets", "EnableVanillaRecipes", true);
    vanillaRecipes.comment = "If true, MFR will register its standard (vanilla-item-only) recipes.";
    thermalExpansionRecipes = c.get("RecipeSets", "EnableThermalExpansionRecipes", false);
    thermalExpansionRecipes.comment = "If true, MFR will register its Thermal Expansion-based recipes.";
    gregTechRecipes = c.get("RecipeSets", "EnableGregTechRecipes", false);
    gregTechRecipes.comment = "If true, MFR will register its GregTech-based recipes.";
   
    for(Machine machine : Machine.values())
    {
      machine.load(c);
    }
   
    c.save();
  }
View Full Code Here

    public void setupConfig(FMLPreInitializationEvent event) {
        File configDir = new File(event.getModConfigurationDirectory().getAbsolutePath() + "/denoflionsx/" + "@NAME@" + "/");
        File configFile = new File(configDir.getAbsolutePath() + "/" + event.getSuggestedConfigurationFile().getName());
        denLibMod.Proxy.makeDirs(configDir);
        Tuning.config = new Configuration(configFile);
        denLibMod.tuning.registerTunableClass(Tuning.class);
    }
View Full Code Here

  @PreInit
  public void preInit(FMLPreInitializationEvent event)
  {
    System.out.println("Initializing Colonies " + Version());
    Configuration config = new Configuration(event.getSuggestedConfigurationFile());
    config.load();
    setConfig(config);
    config.save();
    MinecraftForge.EVENT_BUS.register(new ColoniesSoundManager());
    MinecraftForge.EVENT_BUS.register(new AncientTomeDropsEvent());
  }
View Full Code Here

    @EventHandler
    public void preInit(FMLPreInitializationEvent evt)
    {
        /** Loads the configuration and sets all the values. */
        CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir(), "UniversalElectricity.cfg"));
        CONFIGURATION.load();
        CompatibilityType.THERMAL_EXPANSION.reciprocal_ratio = CONFIGURATION.get("Compatibility", "Thermal Expansion Conversion Ratio", CompatibilityType.THERMAL_EXPANSION.reciprocal_ratio).getDouble(CompatibilityType.THERMAL_EXPANSION.reciprocal_ratio);
        CompatibilityType.INDUSTRIALCRAFT.reciprocal_ratio = CONFIGURATION.get("Compatibility", "IndustrialCraft Conversion Ratio", CompatibilityType.INDUSTRIALCRAFT.reciprocal_ratio).getDouble(CompatibilityType.INDUSTRIALCRAFT.reciprocal_ratio);
        CompatibilityType.BUILDCRAFT.reciprocal_ratio = CONFIGURATION.get("Compatibility", "BuildCraft Conversion Ratio", CompatibilityType.BUILDCRAFT.reciprocal_ratio).getDouble(CompatibilityType.BUILDCRAFT.reciprocal_ratio);

View Full Code Here

    public TunableManager() {
    }

    @Override
    public void registerTunableClass(Class c) {
        Configuration config1 = null;
        tunableClasses.add(c);
        Field[] f = c.getDeclaredFields();
        for (Field d : f) {
            Annotation[] annos = d.getDeclaredAnnotations();
            for (Annotation e : annos) {
                if (e instanceof Config) {
                    Object o = denLib.ReflectionHelper.getStaticField(d);
                    config1 = (Configuration) o;
                }
            }
        }
        Class[] classes = c.getDeclaredClasses();
        for (Class a : classes) {
            Annotation[] annos = a.getDeclaredAnnotations();
            for (Annotation b : annos) {
                if (b instanceof Tunable) {
                    Tunable t = (Tunable) b;
                    String cat = t.category();
                    Field[] g = a.getDeclaredFields();
                    for (Field h : g) {
                        if (config1 != null) {
                            Property p;
                            if (t.category().contains("items")) {
                                p = config1.getItem(cat, h.getName(), Integer.valueOf(denLib.ReflectionHelper.getStaticField(h).toString()));
                            } else {
                                p = config1.get(cat, h.getName(), denLib.ReflectionHelper.getStaticField(h).toString());
                            }

                            denLib.ReflectionHelper.setStaticField(h, p.getString());
                            ConfigCategory a123 = config1.getCategory(cat);
                            if (!t.comment().equals("Tunable Values")) {
                                a123.setComment(t.comment());
                            }
                            Annotation[] fAnno = h.getDeclaredAnnotations();
                            for (Annotation q : fAnno) {
                                if (q instanceof Comment) {
                                    Comment comment = (Comment) q;
                                    p.comment = comment.comment();
                                }
                            }
                        }
                    }
                }
            }
            if (config1 != null) {
                config1.save();
            }
        }
    }
View Full Code Here

TOP

Related Classes of net.minecraftforge.common.Configuration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.