// Path: src/main/java/two/davincing/utils/Utils.java
// public class Utils {
// 
//   public static void forEachInv(IInventory inv, IInvTraversal traversal) {
//     int size = inv.getSizeInventory();
//     for (int i = 0; i < size; i++) {
//       ItemStack is = inv.getStackInSlot(i);
//       if (traversal.visit(i, is)) {
//         return;
//       }
//     }
//   }
// 
//   public static interface IInvTraversal {
// 
//     public boolean visit(int i, ItemStack is);
//   }
// 
//   public static String getClassName(final Object o) {
//     return o == null ? "null" : o.getClass().getName();
//   }
// 
//   public static String getSimpleClassName(final Object o) {
//     return o == null ? "null" : o.getClass().getSimpleName();
//   }
// 
//   public static String blockToString(final Block block) {
//     if (block == null) {
//       return "null";
//     }
//     final String blockIDName = GameData.getBlockRegistry().getNameForObject(block);
//     return blockIDName == null ? block.getUnlocalizedName() : blockIDName;
//   }
// 
//   public static String itemToString(final Item item) {
//     if (item == null) {
//       return "null";
//     } else {
//       final String itemIDName = GameData.getItemRegistry().getNameForObject(item);
//       return itemIDName == null ? item.getUnlocalizedName() : itemIDName;
//     }
//   }
// }


import cpw.mods.fml.common.registry.GameData;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import two.davincing.utils.Utils;
    final Property property = configuration.get(CATEGORY_VARIOUS_SETTINGS, key, defaultValue.toArray(new String[defaultValue.size()]), comment);
    return Arrays.asList(property.getStringList());
  }

  public List<Block> getMiscBlocks(final String key, final List<Block> defaultValue) {
    return getMiscBlocks(key, defaultValue, null);
  }

  public List<Block> getMiscBlocks(final String key, final List<Block> defaultValue, final String comment) {
    final String[] defaultValueStrings = blockListToBlockNames(defaultValue);
    final Property property = configuration.get(CATEGORY_VARIOUS_SETTINGS, key, defaultValueStrings, comment);
    return blockNamesToBlockList(property.getStringList());
  }

  public Configuration getConfiguration() {
    return configuration;
  }

  protected String[] blockListToBlockNames(final List<Block> blockList) {
    if ((blockList == null) || blockList.isEmpty()) {
      return new String[0];
    } else {
      final String[] result = new String[blockList.size()];
      int index = 0;
      for (final Block block : blockList) {
        final String blockname = GameData.getBlockRegistry().getNameForObject(block);
        if (blockname != null) {
          result[index] = blockname;
          ++index;
        } else {
// Path: src/main/java/two/davincing/utils/Utils.java
// public class Utils {
// 
//   public static void forEachInv(IInventory inv, IInvTraversal traversal) {
//     int size = inv.getSizeInventory();
//     for (int i = 0; i < size; i++) {
//       ItemStack is = inv.getStackInSlot(i);
//       if (traversal.visit(i, is)) {
//         return;
//       }
//     }
//   }
// 
//   public static interface IInvTraversal {
// 
//     public boolean visit(int i, ItemStack is);
//   }
// 
//   public static String getClassName(final Object o) {
//     return o == null ? "null" : o.getClass().getName();
//   }
// 
//   public static String getSimpleClassName(final Object o) {
//     return o == null ? "null" : o.getClass().getSimpleName();
//   }
// 
//   public static String blockToString(final Block block) {
//     if (block == null) {
//       return "null";
//     }
//     final String blockIDName = GameData.getBlockRegistry().getNameForObject(block);
//     return blockIDName == null ? block.getUnlocalizedName() : blockIDName;
//   }
// 
//   public static String itemToString(final Item item) {
//     if (item == null) {
//       return "null";
//     } else {
//       final String itemIDName = GameData.getItemRegistry().getNameForObject(item);
//       return itemIDName == null ? item.getUnlocalizedName() : itemIDName;
//     }
//   }
// }


// Path: src/main/java/two/davincing/Config.java
import cpw.mods.fml.common.registry.GameData;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import two.davincing.utils.Utils;

    final Property property = configuration.get(CATEGORY_VARIOUS_SETTINGS, key, defaultValue.toArray(new String[defaultValue.size()]), comment);
    return Arrays.asList(property.getStringList());
  }

  public List<Block> getMiscBlocks(final String key, final List<Block> defaultValue) {
    return getMiscBlocks(key, defaultValue, null);
  }

  public List<Block> getMiscBlocks(final String key, final List<Block> defaultValue, final String comment) {
    final String[] defaultValueStrings = blockListToBlockNames(defaultValue);
    final Property property = configuration.get(CATEGORY_VARIOUS_SETTINGS, key, defaultValueStrings, comment);
    return blockNamesToBlockList(property.getStringList());
  }

  public Configuration getConfiguration() {
    return configuration;
  }

  protected String[] blockListToBlockNames(final List<Block> blockList) {
    if ((blockList == null) || blockList.isEmpty()) {
      return new String[0];
    } else {
      final String[] result = new String[blockList.size()];
      int index = 0;
      for (final Block block : blockList) {
        final String blockname = GameData.getBlockRegistry().getNameForObject(block);
        if (blockname != null) {
          result[index] = blockname;
          ++index;
        } else {
          DaVincing.log.warn("Ignoring invalid block configuration entry: %s", Utils.blockToString(block));