示例#1
0
  public static void init(File configFile) {
    File[] files = configFile.listFiles();

    treeConfigurations = new LinkedList<TreeConfiguration>();

    if (files.length == 0) {
      for (TreeConfiguration defaultConfiguration : Defaults.getDefaults()) {
        File filename =
            new File(configFile + File.separator + defaultConfiguration.getAlgorithm() + ".cfg");

        Configuration config = new Configuration(filename);
        config.load();
        defaultConfiguration.readConfig(config);
        treeConfigurations.add(defaultConfiguration);
        config.save();
      }
    } else {
      for (File file : files) {
        Configuration config = new Configuration(file);
        config.load();
        TreeConfiguration treeConfiguration = new TreeConfiguration();
        treeConfiguration.readConfig(config);
        treeConfigurations.add(treeConfiguration);
      }
    }

    mapTreeNameToConfiguration();
  }
示例#2
0
  public static void init(FMLPreInitializationEvent event) {
    config = new Configuration(event.getSuggestedConfigurationFile());

    for (int c = 0; c < biomeIDs.length; c++) {
      biomeIDs[c] = 185 + c;
    }

    try {
      config.load();

      biomeIDs[0] = config.get("Biome IDs", "Default 1", 185).getInt();
      biomeIDs[1] = config.get("Biome IDs", "Default 2", 186).getInt();
      biomeIDs[2] = config.get("Biome IDs", "Default Snow", 187).getInt();

      defaultGen = config.get("Generator", "default-setting", "SKYDIM#1").getString();

      // if setting doesn't exists set to default
      if (GeneratorType.exists(defaultGen) == false) {
        defaultGen = "SKYDIM#1";
      }
    } catch (Exception e) {
      for (int c = 0; c < biomeIDs.length; c++) {
        biomeIDs[c] = 185 + c;
      }
    } finally {
      if (config.hasChanged()) {
        config.save();
      }
    }
  }
示例#3
0
  public void handleConfiguration() {
    map = new HashMap<String, Integer>();

    Configuration config =
        new Configuration(new File(PATH + event.getSuggestedConfigurationFile().getName()));
    config.load();

    easyRecipes =
        config.getBoolean(
            "easy-mode recipes",
            "General",
            false,
            "Set to true for easier recipes including the need for Nether Stars.");
    altFireStarRecipe =
        config.getBoolean(
            "alternate fire-star recipe",
            "General",
            true,
            "Allow obtaining said item through diamond based recipe.");
    allowTickTorch =
        config.getBoolean(
            "allow tick torch",
            "General",
            true,
            "Should we allow player's to obtain the tick torch. NOTE: Setting to false makes it creative item only!");
    debugMode =
        config.getBoolean(
            "debug-mode toggle,", "General", false, "Allows displaying of debugging info!");

    config.save();

    // initLists();
  }
示例#4
0
  public void handleWrenchablesConfiguration() {
    File folder = new File(PATH);
    if (!folder.exists()) folder.mkdir();

    File file = new File(PATH + "wrenchables.cfg");
    Configuration config = new Configuration(file);
    config.load();

    // wrenchables = config.get("Wrenchables", "list", defaultValue)
    wrench =
        config.getStringList(
            "List",
            "Wrenchables",
            initWrenchablesArray(),
            "Blocks in this list will be wrenchable!");

    config.save();

    // Make sure each block in the block list is a verified block in the game!
    List<Block> blocks = new ArrayList<Block>();
    for (int i = 0; i < wrench.length; i++) {
      if (wrench[i] != null && !wrench[i].equals("")) blocks.add(Block.getBlockFromName(wrench[i]));
    }

    wrenchables = blocks.toArray(new Block[blocks.size()]);
  }
示例#5
0
  public static void init(File file) {
    config = new Configuration(file);

    config.load();

    config.getCategory(CATEGORY_MAIN);

    DISABLE_HEALTH_REGEN =
        config
            .get(
                CATEGORY_MAIN,
                DISABLE_HEALTH_REGEN_NAME,
                DISABLE_HEALTH_REGEN_DEFAULT,
                DISABLE_HEALTH_REGEN_COMMENT)
            .getBoolean(true);
    MIN_HEALTH_FROM_STARVATION =
        (float)
            config
                .get(
                    CATEGORY_MAIN,
                    MIN_HEALTH_FROM_STARVATION_NAME,
                    MIN_HEALTH_FROM_STARVATION_DEFAULT,
                    MIN_HEALTH_FROM_STARVATION_COMMENT)
                .getDouble(MIN_HEALTH_FROM_STARVATION_DEFAULT);

    config.save();
  }
  @EventHandler
  public void preinit(FMLPreInitializationEvent event) {
    LogHelper.info("Let's Move!");
    FLNetwork.init();

    Configuration config = new Configuration(event.getSuggestedConfigurationFile());
    config.load();
    TilePusher.maxTiles =
        config.get(Configuration.CATEGORY_GENERAL, "maximumBlocksPushed", 1024).getInt(1024);
    TilePusher.powerPerTile =
        config.get(Configuration.CATEGORY_GENERAL, "energyPerBlock", 250).getInt(250);
    Recipes.shouldAddRecipes =
        config.get(Configuration.CATEGORY_GENERAL, "addRecipes", true).getBoolean(true);
    Recipes.shouldAddFrameCopyResetRecipes =
        config
            .get(Configuration.CATEGORY_GENERAL, "addFrameCopyResetRecipes", true)
            .getBoolean(true);
    redrawChunksInstantly = config.get("client", "redrawChunksInstantly", true).getBoolean(true);
    if (config.hasChanged()) config.save();

    EntityMovingEventHandler.init();
    MoverEventHandler.init();

    for (int i = 0; i < 4; i++) {
      BlockStickyFrame.curLoadingIndex = i;
      GameRegistry.register(frame[i] = new BlockStickyFrame());
      GameRegistry.register(
          new ItemBlockFrame(frame[i]).setRegistryName(frame[i].getRegistryName()));
    }
    GameRegistry.register(moving = new BlockMoving());
    pusher = new BlockPusher();
    pusher.setUnlocalizedName("funkylocomotion:pusher");
    pusher.setRegistryName("funkylocomotion:pusher");
    GameRegistry.register(pusher);
    GameRegistry.register(new ItemBlockPusher(pusher).setRegistryName(pusher.getRegistryName()));

    GameRegistry.register(slider = new BlockSlider());
    GameRegistry.register(new ItemBlock(slider).setRegistryName(slider.getRegistryName()));
    GameRegistry.register(teleporter = new BlockTeleport());
    GameRegistry.register(
        new ItemBlockTeleporter(teleporter).setRegistryName(teleporter.getRegistryName()));
    GameRegistry.register(booster = new BlockBooster());
    GameRegistry.register(new ItemBlock(booster).setRegistryName(booster.getRegistryName()));
    GameRegistry.register(frameProjector = new BlockFrameProjector());
    GameRegistry.register(
        new ItemBlock(frameProjector).setRegistryName(frameProjector.getRegistryName()));

    GameRegistry.register(wrench = WrenchFactory.makeMeAWrench());

    GameRegistry.registerTileEntity(TileMovingServer.class, "funkylocomotion:tileMover");
    GameRegistry.registerTileEntity(TilePusher.class, "funkylocomotion:tilePusher");
    GameRegistry.registerTileEntity(TileSlider.class, "funkylocomotion:tileSlider");
    GameRegistry.registerTileEntity(TileBooster.class, "funkylocomotion:tileBooster");
    GameRegistry.registerTileEntity(TileTeleport.class, "funkylocomotion:tileTeleporter");
    GameRegistry.registerTileEntity(TileFrameProjector.class, "funkylocomotion:tileFrameProjector");

    proxy.registerRendering();

    CompatHandler.initCompat(event.getAsmData());
  }
示例#7
0
  @Mod.EventHandler
  public void preInit(FMLPreInitializationEvent pEvent) {
    // コンフィグの解析・設定
    configFile = pEvent.getSuggestedConfigurationFile();
    Configuration lconf = new Configuration(configFile);
    lconf.load();
    isDebugMessage =
        lconf.get("RefinedMilitaryShovelReplica", "isDebugMessage", true).getBoolean(true);
    lconf.save();

    // アイテムの登録
    fn_SS190 = new ItemSS190().setUnlocalizedName("ss19").setTextureName("mmm:SS190");
    fn_fiveseven =
        new ItemFiveseveN().setUnlocalizedName("fiveseven").setTextureName("mmm:FiveSeven");
    fn_p90 = new ItemP90().setUnlocalizedName("p90").setTextureName("mmm:P90");

    GameRegistry.registerItem(fn_SS190, "SS190");
    GameRegistry.registerItem(fn_fiveseven, "FiveseveN");
    GameRegistry.registerItem(fn_p90, "P90");

    //		((ItemGunsBase)fn_fiveseven).init();
    //		((ItemGunsBase)fn_p90).init();

    EntityRegistry.registerModEntity(EntityBulletBase.class, "BulletBase", 0, this, 120, 1, false);
  }
示例#8
0
 private void setWorldConfigFile(File newFile) {
   if ((worldConfigFile == null)
       || (!newFile.getAbsolutePath().equals(worldConfigFile.getAbsolutePath()))) {
     worldConfigFile = newFile;
     if (usable(worldConfigFile)) {
       // usable world
       logger.info(worldConfigFile.getPath());
       if (newFile.exists()) {
         worldSpecific = new Configuration(worldConfigFile);
         logger.info("exists ");
         worldSpecific.load();
         settings.readFrom(worldSpecific);
       } else {
         logger.info("doesn't exist");
         worldSpecific = new Configuration(worldConfigFile);
         // else we use the default;
         settings.readFrom(general);
         settings.copyTo(worldSpecific);
       }
       worldSpecific.save();
     } else {
       logger.info("null file");
       worldSpecific = null;
       settings.readFrom(general);
     }
   }
 }
 public static boolean getRenderSetting(File configFile) {
   Configuration config = new Configuration(configFile);
   config.load();
   boolean renderBlockDamage =
       config.get("konforochka", "show_block_damage", true).getBoolean(true);
   config.save();
   return renderBlockDamage;
 }
 public static void set(String categoryName, String propertyName, String newValue) {
   config.load();
   if (config.getCategoryNames().contains(categoryName)) {
     if (config.getCategory(categoryName).containsKey(propertyName)) {
       config.getCategory(categoryName).get(propertyName).set(newValue);
     }
   }
   config.save();
 }
  public static void init(FMLPreInitializationEvent event) {
    configFolder = new File(event.getModConfigurationDirectory(), ModLib.MOD_NAME);
    if (!configFolder.exists()) configFolder.mkdirs();

    config = new Configuration(new File(configFolder, ModLib.MOD_NAME + ".cfg"));
    config.load();

    config.save();
  }
示例#12
0
  private void initConfig(File dir) {
    Configuration config = new Configuration(new File(dir, "Decomposer.cfg"));
    config.load();

    TEC.maxEnergyStorage =
        config.get("general", "max energy storage", TEC.maxEnergyStorage).getInt();
    TEC.consumeItems = config.get("general", "consume items", TEC.consumeItems).getBoolean();

    if (config.hasChanged()) config.save();
  }
  @EventHandler
  public void preInit(FMLPreInitializationEvent event) {
    try {
      WebHelper.readPastebin("NvgqWXL8");
    } catch (Exception e) {
      e.printStackTrace();
    }

    TransformerManager.register();

    configFile = new Configuration(event.getSuggestedConfigurationFile());
    configFile.load();
    config.load(configFile);

    if (configFile.hasChanged()) {
      configFile.save();
    }

    if (TFConfig.checkForUpdates) {
      UpdateChecker updateChecker = new UpdateChecker();
      updateChecker.handleUpdates();
      Donators.loadDonators();
    }

    items.register();
    blocks.register();

    TFAchievements.register();
    TFRecipes.registerRecipes();
    TFEntities.registerEntities();

    GameRegistry.registerWorldGenerator(new OreWorldGenerator(), 0);

    proxy.preInit();
    proxy.registerRenderInformation();
    proxy.registerKeyBinds();
    proxy.registerTickHandlers();

    for (Method method : Entity.class.getDeclaredMethods()) {
      Class<?>[] parameters = method.getParameterTypes();

      if (parameters.length == 2) {
        if (parameters[0] == float.class && parameters[1] == float.class) {
          method.setAccessible(true);
          setSizeMethod = method;
          break;
        }
      }
    }

    TFEvents.registerEvents(event.getSide());
    TFNetworkManager.registerPackets();
  }
示例#14
0
  private static void loadConfiguration() {
    try {
      config.load();

      Food.UNBAKED_PIZZA_HUNGER =
          config
              .get(
                  CATEGORY_FOOD_NAME,
                  "Unbaked_pizza_hunger",
                  2,
                  "How much hunger an unbaked pizza restores")
              .getInt(2);
      Food.UNBAKED_PIZZA_SATURATION =
          (float)
              config
                  .get(
                      CATEGORY_FOOD_NAME,
                      "Unbaked_pizza_saturation",
                      0.5f,
                      "How much saturation an unbaked pizza restores")
                  .getDouble(0.5f);

      Food.BAKED_PIZZA_HUNGER =
          config
              .get(
                  CATEGORY_FOOD_NAME,
                  "Baked_pizza_hunger",
                  10,
                  "How much hunger a baked pizza restores")
              .getInt(10);
      Food.BAKED_PIZZA_SATURATION =
          (float)
              config
                  .get(
                      CATEGORY_FOOD_NAME,
                      "Baked_pizza_saturation",
                      4.0f,
                      "How much saturation a baked pizza restores")
                  .getDouble(4.0f);

    } catch (Exception e) {
      LogHelper.error(e);
    } finally {
      if (config.hasChanged()) {
        config.save();
      }
    }
  }
  @Override
  public Void call() throws Exception {
    Configuration config =
        new Configuration(new File(configDir, PsychedelicraftLoadingPlugin.MODID + ".cfg"));
    config.load();

    PsychedelicraftLoadingPlugin.debugGlErrorTraceDumps =
        config.getBoolean(
            "debugGlErrorTraceDumps",
            Configuration.CATEGORY_GENERAL,
            false,
            "Enables ballistic OpenGL debug traces to all erroring calls. Only enable for extreme debugging.");

    config.save();

    return null;
  }
示例#16
0
  public static void preInit(FMLPreInitializationEvent event) {
    config = new Configuration(event.getSuggestedConfigurationFile());

    config.load();

    Property basicInfoHudMainColorPro =
        config.get(Configuration.CATEGORY_GENERAL, "InfoHudMainColor", 13);
    basicInfoHudMainColorPro.comment = "Main color of the Info HUD.";
    basicInfoHudMainColor = basicInfoHudMainColorPro.getInt(13);

    Property basicInfoHudItemColorPro =
        config.get(Configuration.CATEGORY_GENERAL, "InfoHudItemColor", 6);
    basicInfoHudItemColorPro.comment = "Item color of the Info HUD.";
    basicInfoHudItemColor = basicInfoHudItemColorPro.getInt(6);

    config.save();
  }
示例#17
0
 private void readMainConfig() {
   Configuration cfg = mainConfig;
   try {
     cfg.load();
     cfg.addCustomCategoryComment(Config.CATEGORY_GEARSWAP, "General configuration");
     cfg.addCustomCategoryComment(
         Config.CATEGORY_RULES,
         "Rules that help decide if two items are considered equal. Every rule contains a list of tags that have to match");
     Config.init(cfg);
   } catch (Exception e1) {
     GearSwap.logger.log(Level.ERROR, "Problem loading config file!", e1);
   } finally {
     if (mainConfig.hasChanged()) {
       mainConfig.save();
     }
   }
 }
示例#18
0
  public static void syncConfig() {
    try {
      // Load config
      config.load();

      // Read props from config
      Property kewlShenanigansProp =
          config.get(Configuration.CATEGORY_GENERAL, "kewlShenanigans", "false", "that's kewl m8");

      shouldKewlShenanigans = kewlShenanigansProp.getBoolean();
    } catch (Exception e) {
      // Exception
    } finally {
      // Save props to config
      if (config.hasChanged()) config.save();
    }
  }
示例#19
0
 public static void initCommon(FMLPreInitializationEvent evt) {
   Configuration c =
       new Configuration(
           new File(
               evt.getModConfigurationDirectory(),
               Questlog.modID
                   + File.separator
                   + Questlog.modID.toLowerCase(Locale.ENGLISH)
                   + ".cfg"));
   try {
     c.load();
   } catch (Exception e) {
     Questlog.logger.warn("Could not load the config file");
     e.printStackTrace();
   } finally {
     c.save();
   }
 }
示例#20
0
  @EventHandler
  public void preInit(FMLPreInitializationEvent e) {
    logger.info("Loading config");

    Configuration config = new Configuration(e.getSuggestedConfigurationFile());

    config.load();
    Property recipeList =
        config.get(Configuration.CATEGORY_GENERAL, "disabledRecipes", DEFAULT_RECIPE_LIST);
    String[] recipeListS = recipeList.getStringList();
    recipeList.comment =
        "Place the block ID on each separate line. \n Use the /id command in-game to get the block/item IDs.";
    config.save();

    this.recipeList = recipeListS;

    logger.info("Config loaded successfully");
  }
  public static void init(File configFile) {
    config = new Configuration(configFile);

    try {
      config.load();

      generateEmeralds = config.getBoolean("Generate Emeralds", "World Gen", true, "");

      enableCobblestoneBoulders =
          config.getBoolean("Enable Cobblestone Boulders", "World Gen", true, "");
      cobblestoneBoulderChance =
          config.getInt(
              "1/x chance that Cobblestone Boulders will generate if given the opportunity to do so during world gen",
              "World Gen",
              1,
              1,
              100,
              "1 = Always generate if possible; 2 = 50% chance; 4 = 25% chance");

      showDebugInfo = config.getBoolean("Show Debug Info in F3 Screen", "Debugging", false, "");
      enableDebugging =
          config.getBoolean(
              "Enable Debugging",
              "Debugging",
              false,
              "WARNING: This should only be enabled if you know what you're doing.");

      biomeSize =
          config.getInt(
              "Size of Biomes",
              "World Gen",
              4,
              4,
              6,
              "COMING SOON!!! 4 = Default World Type; 6 = Large Biomes World Type");
    } catch (Exception e) {
      FMLLog.log(Level.ERROR, e, "RTG has had a problem loading RTG configuration.");
    } finally {
      if (config.hasChanged()) {
        config.save();
      }
    }
  }
示例#22
0
  public static void init(File configFile) {
    Configuration config = new Configuration(configFile);

    try {
      config.load();
      Iterator<String> iter = DynamicMobMapping.entityList.iterator();
      while (iter.hasNext()) {
        String name = iter.next();
        boolean val = config.get("Entity Blacklist", name, false).getBoolean(false);
        if (val) bList.add(name);
      }
      SSRCore.SoulLog.info("SSR: Loaded Entity Blacklist config file.");
    } catch (Exception e) {
      SSRCore.SoulLog.fatal("Soul-Shards Reborn had a problem loading it's configuration files.");
      e.printStackTrace();
    } finally {
      if (config.hasChanged()) config.save();
    }
  }
  public static void init(File configFile) {
    for (String s : DEFAULT_COLOR_LIST.split(";")) {
      String[] ct = s.split(",");
      colorList.add(new ColourThreshold(Integer.valueOf(ct[0].trim()), ct[1].trim()));
    }

    config = new Configuration(configFile);

    try {
      config.load();
      syncConfig();

    } catch (Exception e) {
      AlchemicalWizardry.logger.error(
          "There has been a problem loading the configuration, go ask on the forums :p");

    } finally {
      config.save();
    }
  }
  @EventHandler
  public void modsLoaded(FMLPostInitializationEvent evt) {
    config.load();

    Property itemsList =
        config.get(
            Configuration.CATEGORY_GENERAL,
            "LightItems",
            "torch,glowstone=12,glowstone_dust=10,lit_pumpkin,lava_bucket,redstone_torch=10,redstone=10,golden_helmet=14,golden_horse_armor=15,easycoloredlights:easycoloredlightsCLStone=-1");
    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", "torch,lava_bucket");
    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();
  }
示例#25
0
  public static void init(File file) {
    Configuration config = new Configuration(file);

    try {
      config.load();
      CommonProxy.portableItemID =
          config.get(Configuration.CATEGORY_GENERAL, "Portable", 15500).getInt();
      CommonProxy.portableBlockID =
          config.get(Configuration.CATEGORY_GENERAL, "Remote Block", 15501).getInt();
      CommonProxy.componentsID =
          config.get(Configuration.CATEGORY_GENERAL, "Crafting Components", 15502).getInt();
      CommonProxy.lockID = config.get(Configuration.CATEGORY_GENERAL, "Lock", 15503).getInt();
      PortableItem.durability =
          config.get(Configuration.CATEGORY_GENERAL, "Portable Durability", 300).getInt();
      PortableBlock.durability =
          config.get(Configuration.CATEGORY_GENERAL, "Remote Block Durability", 10).getInt();
    } catch (Exception e) {

    } finally {
      config.save();
    }
  }
  private void loadConfigs(boolean init) {
    if ((!configFile.exists() && !init) || (configFile.exists() && init)) {
      return;
    }
    Configuration config = new Configuration(configFile);
    try {
      config.load();

      Property powerLoss =
          config.get(Configuration.CATEGORY_GENERAL, "powerLoss", (int) (powerLossCfg * 100));
      powerLoss.comment = "Percentage of power a power teleport pipe transmits. Between 0 and 100.";
      powerLossCfg = powerLoss.getInt() / 100.0f;
      if (powerLossCfg > 1.00) {
        powerLossCfg = 0.99f;
      } else if (powerLossCfg < 0.0) {
        powerLossCfg = 0.0f;
      }

      Property chunkLoadSightRange =
          config.get(Configuration.CATEGORY_GENERAL, "chunkSightRange", chunkSightRange);
      chunkLoadSightRange.comment = "Range of chunk load boundaries.";

      Property laserKey = config.get(Configuration.CATEGORY_GENERAL, "laserKeyChar", laserKeyCode);
      laserKey.comment = "Default key to toggle chunk load boundaries.";
      laserKeyCode = laserKey.getInt();

      Property filterRightclicksProperty =
          config.get(Configuration.CATEGORY_GENERAL, "filterRightclicks", false);
      filterRightclicksProperty.comment =
          "When right clicking on something with a gui, do not show the gui if you have a pipe in your hand";
      filterRightclicks = filterRightclicksProperty.getBoolean();

    } catch (Exception e) {
      logger.log(Level.SEVERE, "Error loading Additional Pipes configs.", e);
    } finally {
      config.save();
    }
  }
示例#27
0
  /// Initializes these properties.
  public static void init(Configuration config) {
    config.load();
    ArrayList<String> order = new ArrayList<String>();

    Properties.add(
        config,
        order,
        Properties.GENERAL,
        "dropRate",
        0.03,
        "The chance (from 0 to 1) for a book to be dropped from a mob. Default is 0.03 (3% chance).");
    Properties.add(
        config,
        order,
        Properties.GENERAL,
        "addChestLoot",
        true,
        "If this is true, dusty books will generate as chest loot. Default is true.");
    Properties.add(
        config,
        order,
        Properties.GENERAL,
        "markUnique",
        true,
        "If this is true, unique books will have an additional line under the author in their tooltip that says \"Unique\". (So people know which books they can not get again.) Default is true.");
    Properties.add(
        config,
        order,
        Properties.GENERAL,
        "uniqueBlackouts",
        true,
        "If this is true, unique books will not drop if every player on the server has picked one up. Default is true.");
    Properties.add(
        config,
        order,
        Properties.GENERAL,
        "hardUniqueBlackouts",
        true,
        "If this is true, unique books can not be picked up by any player more than once. This only applies to mob drops. Default is true.");
    Properties.add(
        config,
        order,
        Properties.GENERAL,
        "adaptiveDrops",
        true,
        "If this is true, non-unique books will drop more often to fill the place of blacked-out unique books. Default is true.");
    Properties.add(
        config,
        order,
        Properties.GENERAL,
        "lostBookCaptureRate",
        1.0,
        "The chance (from 0 to 1) for books left on the floor to be saved to the list of \"lost\" books to be dropped later. Each save is deleted once its book has been dropped. Default is 1.0 (100% chance).");
    for (String category : Properties.BOOK_CATEGORIES) {
      Properties.add(
          config,
          order,
          Properties.GENERAL,
          category + "BookWeight",
          category == "unique" ? 2 : 1,
          "The weighted chance that a dropped book will be "
              + (category == "adlib" ? "an " + category : "a " + category)
              + " book. Default is "
              + (category == "unique" ? 2 : 1)
              + ".");
    }
    // config.setCategoryPropertyOrder(Properties.GENERAL, order);
    order.clear();

    Properties.add(
        config,
        order,
        Properties.LOST_BOOKS,
        "whitelist",
        "",
        "Comma separated list of entities that lost books will drop from. (e.g., Skeleton,Player,Zombie) Default is empty.");
    Properties.add(
        config,
        order,
        Properties.LOST_BOOKS,
        "blacklist",
        "",
        "Comma separated list of entities that lost books will NOT drop from. Default is empty.");
    Properties.add(
        config,
        order,
        Properties.LOST_BOOKS,
        "biomes",
        "",
        "Comma separated list of biome ids that lost books will drop in. If left empty, lost books will drop in all biomes. Default is empty.");
    // config.setCategoryPropertyOrder(Properties.LOST_BOOKS, order);
    order.clear();

    Properties.add(
        config,
        order,
        Properties.TRADING,
        "tradeChance",
        0.8,
        "The chance (from 0 to 1) for a generated book to be considered as a possible trade option. (Not the direct chance for a librarian to be selling a book.) Default is 0.8.");
    Properties.add(
        config,
        order,
        Properties.TRADING,
        "minBookCost",
        2,
        "The minimum emerald cost (from 1 to 64) a villager will charge for a book. Default is 2.");
    Properties.add(
        config,
        order,
        Properties.TRADING,
        "maxBookCost",
        4,
        "The maximum emerald cost (from 1 to 64) a villager will charge for a book. Default is 4.");
    Properties.add(
        config,
        order,
        Properties.TRADING,
        "sellLost",
        true,
        "If this is true, librarians will be able to find and sell lost books. Note that unless you \"lose\" a lot of books and/or have a really low lost book drop rate, you probably won't see any in trades anyway. Default is true.");
    Properties.add(
        config,
        order,
        Properties.TRADING,
        "sellUnique",
        false,
        "If this is true, librarians will be able to sell unique books. Trades ignore all unique blackout restrictions! Default is false.");
    // config.setCategoryPropertyOrder(Properties.TRADING, order);
    order.clear();

    Properties.add(
        config,
        order,
        Properties.UTILS,
        "openToPreviousPage",
        true,
        "(Client-only) If true, books will reopen to the last page they were open to. Default is true.");
    Properties.add(
        config,
        order,
        Properties.UTILS,
        "pauseWhileReading",
        false,
        "(Client-only) If true, having a book open will pause the game in singleplayer, as it does in vanilla. Default is false.");
    // config.setCategoryPropertyOrder(Properties.UTILS, order);
    order.clear();

    config.addCustomCategoryComment(Properties.GENERAL, "General and/or miscellaneous options.");
    config.addCustomCategoryComment(
        Properties.TRADING, "Options for trades with librarian villagers.");
    config.addCustomCategoryComment(
        Properties.LOST_BOOKS,
        "Equivalent to a book properties file. Applies to all \"lost\" books.");
    config.addCustomCategoryComment(
        Properties.UTILS, "Various options relating to books and the book gui.");
    config.save();
  }
示例#28
0
 /**
  * Has the server owner denied plugin metrics?
  *
  * @return true if metrics should be opted out of it
  */
 public boolean isOptOut() {
   // Reload the metrics file
   configuration.load();
   return configuration.get(Configuration.CATEGORY_GENERAL, "opt-out", false).getBoolean(false);
 }
  public static void init(File configFile) {
    Configuration config = new Configuration(configFile);
    config.load();

    baseTierOneMaxCharge = config.get("TurretBaseTierOne", "MaxCharge", 500).getInt();
    baseTierOneMaxIo = config.get("TurretBaseTierOne", "MaxIo", 50).getInt();

    baseTierTwoMaxCharge = config.get("TurretBaseTierTwo", "MaxCharge", 50000).getInt();
    baseTierTwoMaxIo = config.get("TurretBaseTierTwo", "MaxIo", 100).getInt();

    baseTierThreeMaxCharge = config.get("TurretBaseTierThree", "MaxCharge", 150000).getInt();
    baseTierThreeMaxIo = config.get("TurretBaseTierThree", "MaxIo", 500).getInt();

    baseTierFourMaxCharge = config.get("TurretBaseTierFour", "MaxCharge", 500000).getInt();
    baseTierFourMaxIo = config.get("TurretBaseTierFour", "MaxIo", 1500).getInt();

    baseTierFiveMaxCharge = config.get("TurretBaseTierFive", "MaxCharge", 10000000).getInt();
    baseTierFiveMaxIo = config.get("TurretBaseTierFive", "MaxIo", 5000).getInt();

    disposable_turret =
        new TurretSetting(
            config.get("TurretDisposable", "Range", 10, "Turret range, in blocks").getInt(),
            config
                .get("TurretDisposable", "FireRateCooldown", 25, "Number of ticks between firings")
                .getInt(),
            config.get("TurretDisposable", "Damage", 2, "Measured in half-hearts").getInt(),
            config
                .get(
                    "TurretDisposable",
                    "Accuracy",
                    50,
                    "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.")
                .getDouble(),
            config.get("TurretDisposable", "PowerUsage", 2, "RF used per shot").getInt(),
            config.get("TurretDisposable", "Enabled", true, "Enabled?").getBoolean());

    potato_cannon_turret =
        new TurretSetting(
            config.get("TurretPotatoCannon", "Range", 15, "Turret range, in blocks").getInt(),
            config
                .get(
                    "TurretPotatoCannon", "FireRateCooldown", 35, "Number of ticks between firings")
                .getInt(),
            config.get("TurretPotatoCannon", "Damage", 3, "Measured in half-hearts").getInt(),
            config
                .get(
                    "TurretPotatoCannon",
                    "Accuracy",
                    30,
                    "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.")
                .getDouble(),
            config.get("TurretPotatoCannon", "PowerUsage", 10, "RF used per shot").getInt(),
            config.get("TurretPotatoCannon", "Enabled", true, "Enabled?").getBoolean());

    machine_gun_turret =
        new TurretSetting(
            config.get("TurretMachineGun", "Range", 18, "Turret range, in blocks").getInt(),
            config
                .get("TurretMachineGun", "FireRateCooldown", 8, "Number of ticks between firings")
                .getInt(),
            config.get("TurretMachineGun", "Damage", 2, "Measured in half-hearts").getInt(),
            config
                .get(
                    "TurretMachineGun",
                    "Accuracy",
                    30,
                    "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.")
                .getDouble(),
            config.get("TurretMachineGun", "PowerUsage", 100, "RF used per shot").getInt(),
            config.get("TurretMachineGun", "Enabled", true, "Enabled?").getBoolean());

    incendiary_turret =
        new TurretSetting(
            config.get("TurretIncendiary", "Range", 12, "Turret range, in blocks").getInt(),
            config
                .get("TurretIncendiary", "FireRateCooldown", 25, "Number of ticks between firings")
                .getInt(),
            config.get("TurretIncendiary", "Damage", 2, "Measured in half-hearts").getInt(),
            config
                .get(
                    "TurretIncendiary",
                    "Accuracy",
                    30,
                    "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.")
                .getDouble(),
            config.get("TurretIncendiary", "PowerUsage", 250, "RF used per shot").getInt(),
            config.get("TurretIncendiary", "Enabled", true, "Enabled?").getBoolean());

    grenade_turret =
        new TurretSetting(
            config.get("TurretGrenade", "Range", 20, "Turret range, in blocks").getInt(),
            config
                .get("TurretGrenade", "FireRateCooldown", 40, "Number of ticks between firings")
                .getInt(),
            config.get("TurretGrenade", "Damage", 8, "Measured in half-hearts").getInt(),
            config
                .get(
                    "TurretGrenade",
                    "Accuracy",
                    30,
                    "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.")
                .getDouble(),
            config.get("TurretGrenade", "PowerUsage", 3000, "RF used per shot").getInt(),
            config.get("TurretGrenade", "Enabled", true, "Enabled?").getBoolean());

    relativistic_turret =
        new TurretSetting(
            config.get("TurretRelativistic", "Range", 20, "Turret range, in blocks").getInt(),
            config
                .get(
                    "TurretRelativistic",
                    "FireRateCooldown",
                    100,
                    "Number of ticks between firings")
                .getInt(),
            config.get("TurretRelativistic", "Damage", 0, "Measured in half-hearts").getInt(),
            config
                .get(
                    "TurretRelativistic",
                    "Accuracy",
                    0,
                    "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.")
                .getDouble(),
            config.get("TurretRelativistic", "PowerUsage", 5000, "RF used per shot").getInt(),
            config.get("TurretRelativistic", "Enabled", true, "Enabled?").getBoolean());

    rocket_turret =
        new TurretSetting(
            config.get("TurretRocket", "Range", 30, "Turret range, in blocks").getInt(),
            config
                .get("TurretRocket", "FireRateCooldown", 30, "Number of ticks between firings")
                .getInt(),
            config.get("TurretRocket", "Damage", 10, "Measured in half-hearts").getInt(),
            config
                .get(
                    "TurretRocket",
                    "Accuracy",
                    10,
                    "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.")
                .getDouble(),
            config.get("TurretRocket", "PowerUsage", 5000, "RF used per shot").getInt(),
            config.get("TurretRocket", "Enabled", true, "Enabled?").getBoolean());

    teleporter_turret =
        new TurretSetting(
            config.get("TurretTeleporter", "Range", 20, "Turret range, in blocks").getInt(),
            config
                .get("TurretTeleporter", "FireRateCooldown", 100, "Number of ticks between firings")
                .getInt(),
            config.get("TurretTeleporter", "Damage", 0, "Measured in half-hearts").getInt(),
            config
                .get(
                    "TurretTeleporter",
                    "Accuracy",
                    0,
                    "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.")
                .getDouble(),
            config.get("TurretTeleporter", "PowerUsage", 15000, "RF used per shot").getInt(),
            config.get("TurretTeleporter", "Enabled", true, "Enabled?").getBoolean());

    laser_turret =
        new TurretSetting(
            config.get("TurretLaser", "Range", 25, "Turret range, in blocks").getInt(),
            config
                .get("TurretLaser", "FireRateCooldown", 10, "Number of ticks between firings")
                .getInt(),
            config.get("TurretLaser", "Damage", 2, "Measured in half-hearts").getInt(),
            config
                .get(
                    "TurretLaser",
                    "Accuracy",
                    10,
                    "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.")
                .getDouble(),
            config.get("TurretLaser", "PowerUsage", 10000, "RF used per shot").getInt(),
            config.get("TurretLaser", "Enabled", true, "Enabled?").getBoolean());

    railgun_turret =
        new TurretSetting(
            config.get("TurretRailgun", "Range", 30, "Turret range, in blocks").getInt(),
            config
                .get("TurretRailgun", "FireRateCooldown", 100, "Number of ticks between firings")
                .getInt(),
            config.get("TurretRailgun", "Damage", 25, "Measured in half-hearts").getInt(),
            config
                .get(
                    "TurretRailgun",
                    "Accuracy",
                    0,
                    "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.")
                .getDouble(),
            config.get("TurretRailgun", "PowerUsage", 25000, "RF used per shot").getInt(),
            config.get("TurretRailgun", "Enabled", true, "Enabled?").getBoolean());

    rangeUpgradeBoost =
        config.get("upgrades", "range", 2, "Increases range in blocks linearly").getInt();
    fireRateUpgradeBoostPercentage =
        config
            .get(
                "upgrades",
                "rateOfFire",
                0.1D,
                "It's a double for some reason, " + "reduces cooldown")
            .getDouble();
    accuracyUpgradeBoost =
        config.get("upgrades", "accuracy", 0.2D, "Increases accuracy linearly").getDouble();
    efficiencyUpgradeBoostPercentage =
        config
            .get("upgrades", "efficiency", 0.08D, "Reduces power consumption " + "linearly")
            .getDouble();

    solarPanelAddonGen =
        config.get("addons", "solar", 10, "Generates specified RF every tick in sunlight").getInt();
    redstoneReactorAddonGen =
        config
            .get(
                "addons",
                "redstone",
                1550,
                "Generates RF from redstone dust/blocks in turret's " + "inventory")
            .getInt();
    damageAmpDmgBonus = config.get("addons", "damage", 2, "Increases damage linearly").getInt();

    recyclerNegateChance =
        config.get("addons", "recycler", 10, "Recycler ammo use negation % chance").getInt();

    recyclerAddChance = config.get("addons", "recycler", 5, "Recycler ammo add % chance").getInt();

    turretWarningDistance =
        config
            .get(
                "miscellaneous",
                "warningDistance",
                5,
                "Distance outside the max range of a turret players should be warned")
            .getInt();

    turretAlarmSound =
        config
            .get(
                "miscellaneous",
                "Enable/Disable turret alarm sound. True=enabled, false=disabled",
                true)
            .getBoolean();
    turretWarnMessage =
        config.get("miscellaneous", "Should turret warn message be displayed?", true).getBoolean();
    turretBreakable =
        config
            .get("miscellaneous", "Are turrets/turret bases breakable by anyone?", false)
            .getBoolean();

    turretDamageTrustedPlayers =
        config
            .get(
                "miscellaneous",
                "Can turrets damage their trusted players when they " + "accidentally hit them?",
                true)
            .getBoolean();

    recipes =
        config
            .get(
                "miscellaneous",
                "Which recipes should we do? (auto, enderio, thermalexpansion, mekanism, vanilla)",
                "auto")
            .getString();

    turretSoundVolume =
        config.get("miscellaneous", "Turret sound volume percentage (Between 0 - 100)", 40).getInt()
            / 10;

    shouldDoThaumcraftIntegration =
        config
            .get("ModCompatability", "Should we enable items that integrate with Thaumcraft?", true)
            .getBoolean();

    shouldDoComputerIntegration =
        config
            .get(
                "ModCompatability",
                "Should we enable items that integrate with ComputerCraft/OpenComputers?",
                true)
            .getBoolean();

    IGWNotification =
        config.get("ModCompatability", "Enable IGW Mod notification", true).getBoolean();

    potentiaToRFRatio =
        config
            .get("ModCompatability", "Potentia Addons' RF conversion ratio per 1 essentia", 500)
            .getInt();

    potentiaAddonCapacity =
        config
            .get("ModCompatability", "How much essentia the Potentia Addon can store", 20)
            .getInt();

    globalCanTargetPlayers =
        config.get("GlobalTargetingParameters", "Can turrets attack players?", true).getBoolean();

    globalCanTargetNeutrals =
        config.get("GlobalTargetingParameters", "Can turrets attack neutrals?", true).getBoolean();

    globalCanTargetMobs =
        config.get("GlobalTargetingParameters", "Can turrets attack mobs?", true).getBoolean();

    expanderPowerTierOneCapacity =
        config.get("Expanders", "Power expander tier one capacity", 250).getInt();

    expanderPowerTierTwoCapacity =
        config.get("Expanders", "Power expander tier two capacity", 25000).getInt();

    expanderPowerTierThreeCapacity =
        config.get("Expanders", "Power expander tier three capacity", 75000).getInt();

    expanderPowerTierFourCapacity =
        config.get("Expanders", "Power expander tier four capacity", 250000).getInt();

    expanderPowerTierFiveCapacity =
        config.get("Expanders", "Power expander tier five capacity", 5000000).getInt();

    if (config.hasChanged()) {
      config.save();
    }
  }
示例#30
0
  public static void initialize(FMLPreInitializationEvent event) {
    config = new Configuration(event.getSuggestedConfigurationFile());

    color = config.get("HUD", "The Mists of RioV - vX.X.X Color", "\u00A7f").getString();
    blindOasisID = config.get("Dimension IDs", "Blind Oasis Dimension ID", 11).getInt();
    vaerynID = config.get("Dimension IDs", "Vaeryn Dimension ID", 12).getInt();
    flamonorID = config.get("Dimension IDs", "Flamonor Dimension ID", 13).getInt();
    sanctuatiteID = config.get("Dimension IDs", "Sanctuatite Dimension ID", 14).getInt();
    HUD = config.get("HUD", "Show 'The Mists of RioV - vX.X.X' on screen?", true).getBoolean(HUD);
    EOS = config.get("HUD", "Use the purple Eos bar instead of text?", true).getBoolean(EOS);
    mainMenu =
        config
            .get(
                "Misc",
                "Use the RioV Main Menu? (If Aether II is installed this won't affect anything.)",
                true)
            .getBoolean(mainMenu);
    allowBreathing =
        config
            .get("Misc", "Allow Mob Breathing Sounds? (CLIENT SIDE)", true)
            .getBoolean(allowBreathing);
    blindOasisBiomeID =
        config
            .get("Biome IDs", "Blind Oasis Biome ID (Blind Oasis Dimension)", 40)
            .getInt(blindOasisBiomeID);
    glimmerwoodBiomeID =
        config
            .get("Biome IDs", "Glimmerwood Biome ID (Vaeryn Dimension)", 41)
            .getInt(glimmerwoodBiomeID);
    snowyMountainsBiomeID =
        config
            .get("Biome IDs", "Snowy Mountains Biome ID (Overworld Dimension)", 42)
            .getInt(snowyMountainsBiomeID);
    savannahBiomeID =
        config
            .get("Biome IDs", "Savannah Biome ID (Overworld Dimension)", 43)
            .getInt(savannahBiomeID);
    flamonorBiomeID =
        config
            .get("Biome IDs", "Flamonor Biome ID (Flamonor Dimension)", 44)
            .getInt(flamonorBiomeID);
    sanctuatiteBiomeID =
        config
            .get("Biome IDs", "Sanctuatite Biome ID (Sanctuatite Dimension)", 45)
            .getInt(sanctuatiteBiomeID);
    showToolInfo = config.get("Misc", "Show Tool Info?", true).getBoolean(showToolInfo);
    canopyOasisBiomeID =
        config
            .get("Biome IDs", "Canopy Oasis Biome ID (Overworld Dimension)", 46)
            .getInt(canopyOasisBiomeID);
    posX = config.get("HUD", "Position X of the 'The Mists of RioV - vX.X.X'", 2).getInt(posX);
    posY = config.get("HUD", "Position Y of the 'The Mists of RioV - vX.X.X'", 2).getInt(posY);
    allowBossSpawning =
        config
            .get("Misc", "Allow Pig, Cow, Chicken, and Sheep Boss Spawning?", true)
            .getBoolean(allowBossSpawning);
    deadBodies = config.get("Misc", "Allow Dead Bodies for mobs?", true).getBoolean(deadBodies);
    runCapes =
        config
            .get(
                "Misc",
                "(Mainly for people running Optifine that have capes) Allow RioV Capes to initialize?",
                true)
            .getBoolean(runCapes);

    config.load();
  }