예제 #1
0
 void loadConfig() {
   config = new OrderedProperties();
   try {
     config.load(new FileInputStream(cfgfile));
   } catch (FileNotFoundException e) {
     System.out.printf("%s: No existing config file\n", modName);
   } catch (IOException e) {
     System.out.printf("%s: Failed to read %s\n%s\n", modName, cfgfile.getPath(), e);
   }
   config.extended = false;
   Floodlight.init(config);
 }
예제 #2
0
 public static int getBlockOrItemID(int defaultID, String name, int offset) {
   String key = name + ".id";
   int id;
   if (config.containsKey(key)) {
     String value = (String) config.get(key);
     id = Integer.parseInt(value);
   } else {
     config.put(key, Integer.toString(defaultID));
     id = defaultID;
   }
   idToName.put(Integer.valueOf(offset + id), name);
   return id;
 }
예제 #3
0
 void addRecipes() {
   if (config.getBoolean("enableSimpleFloodlight", true)) {
     addRecipe(
         floodlight,
         1,
         "IrI",
         "IgI",
         "GGG",
         'I',
         Item.ingotIron,
         'r',
         Item.redstone,
         'g',
         glowingIngot,
         'G',
         Block.glass);
     addRecipe(
         glowingIngot,
         1,
         "GiG",
         "igi",
         "GiG",
         'G',
         Block.glowStone,
         'g',
         Item.goldNugget,
         'i',
         Item.ingotIron);
   }
 }
예제 #4
0
 void saveConfig() {
   try {
     if (config.extended) {
       System.out.printf("%s: Writing config file\n", modName);
       config.store(new FileOutputStream(cfgfile), modName + " Configuration File");
     }
   } catch (IOException e) {
     System.out.printf("%s: Failed to %s\n%s\n", modName, cfgfile.getPath(), e);
   }
 }