// Path: src/main/java/portablejim/veinminer/configuration/json/ToolStruct.java
// public class ToolStruct {
//     public String name;
//     public String icon;
//     public String[] toollist;
//     public String[] blocklist;
// }
// 
// Path: src/main/java/portablejim/veinminer/util/BlockID.java
// public class BlockID implements Comparable<BlockID>
// {
//     public String name;
//     public int metadata;
//     public IBlockState state = null;
//     
//     public BlockID(String fullDescription) {
//         int preMeta = -1;
//         Pattern p = Pattern.compile("([^/]+)(?:/([-]?\\d{1,2}))?");
//         Matcher m = p.matcher(fullDescription);
// 
//         if(m.matches()) {
//             name = m.group(1);
//             if(m.group(2) != null) {
//                 try {
//                     preMeta = Integer.parseInt(m.group(2));
//                 }
//                 catch (NumberFormatException e) {
//                     preMeta = -1;
//                 }
//             }
//         }
//         else {
//             name = "";
//         }
//         metadata = preMeta >= -1 ? preMeta : -1;
//     }
// 
//     public BlockID(String name, int meta) {
//         this.name = name;
//         this.metadata =  meta < -1 || meta == OreDictionary.WILDCARD_VALUE ? -1 : meta;
//     }
// 
//     @Deprecated
//     public BlockID(World world, BlockPos position) {
//         this(world.getBlockState(position));
//     }
// 
//     public BlockID(IBlockState state) {
//         this(Block.blockRegistry.getNameForObject(state.getBlock()).toString(), state.getBlock().getMetaFromState(state));
//         this.state = state;
//     }
// 
//     @Override
//     public boolean equals(Object obj)
//     {
//         if (this == obj)
//             return true;
//         
//         if (!(obj instanceof BlockID))
//             return false;
// 
//         BlockID o = (BlockID) obj;
//         return name.equals(o.name) && metadata == o.metadata;
//     }
// 
//     /**
//      * Compare the objects using the metadata value of -1 to be a wildcard that matches all.
//      * @param obj The object to compare to this one
//      * @return Whether this object and obj are equal, using the wildcard value.
//      */
//     public boolean wildcardEquals(Object obj)
//     {
//         if (this == obj)
//             return true;
// 
//         if (!(obj instanceof BlockID))
//             return false;
// 
//         BlockID o = (BlockID) obj;
//         if (o.metadata == -1 || metadata == -1)
//             return this.equals(obj);
//         else
//             return name.equals(o.name) && metadata == o.metadata;
//     }
//     
//     @Override
//     public int hashCode()
//     {
//         return (this.name.hashCode() << 6) + this.metadata;
//     }
//     
//     @Override
//     public String toString()
//     {
//         return (metadata == -1 ? name + "" : name + "/" + metadata);
//     }
// 
//     @Override
//     public int compareTo(BlockID blockID) {
//         if(name != null && !name.equals(blockID.name)) {
//             int result = name.compareTo(blockID.name);
//             if(result > 0) return 1;
//             else if (result < 0) return -1;
//             return 0;
//         }
//         else if(metadata < blockID.metadata) {
//             return -1;
//         }
//         else if(metadata > blockID.metadata) {
//             return 1;
//         }
//         else {
//             return 0;
//         }
//     }
// }


import portablejim.veinminer.configuration.json.ToolStruct;
import portablejim.veinminer.util.BlockID;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
package portablejim.veinminer.configuration;



/**
 * Class to manage tool tool lists and block lists.
 */
public class Tool {
    public String name;
    public String icon;
    public Set<String> toollist;
    public Set<BlockID> blocklist;

    public Tool(String name, String icon, String[] toollist, String[] blocklist) {
	    this.name = name;
	    this.icon = icon;
        this.toollist = new HashSet<String>(toollist.length);
        this.blocklist = new HashSet<BlockID>(blocklist.length);
	    Collections.addAll(this.toollist, toollist);
	    for(String block : blocklist) {
	        this.blocklist.add(new BlockID(block));
	    }
    }

// Path: src/main/java/portablejim/veinminer/configuration/json/ToolStruct.java
// public class ToolStruct {
//     public String name;
//     public String icon;
//     public String[] toollist;
//     public String[] blocklist;
// }
// 
// Path: src/main/java/portablejim/veinminer/util/BlockID.java
// public class BlockID implements Comparable<BlockID>
// {
//     public String name;
//     public int metadata;
//     public IBlockState state = null;
//     
//     public BlockID(String fullDescription) {
//         int preMeta = -1;
//         Pattern p = Pattern.compile("([^/]+)(?:/([-]?\\d{1,2}))?");
//         Matcher m = p.matcher(fullDescription);
// 
//         if(m.matches()) {
//             name = m.group(1);
//             if(m.group(2) != null) {
//                 try {
//                     preMeta = Integer.parseInt(m.group(2));
//                 }
//                 catch (NumberFormatException e) {
//                     preMeta = -1;
//                 }
//             }
//         }
//         else {
//             name = "";
//         }
//         metadata = preMeta >= -1 ? preMeta : -1;
//     }
// 
//     public BlockID(String name, int meta) {
//         this.name = name;
//         this.metadata =  meta < -1 || meta == OreDictionary.WILDCARD_VALUE ? -1 : meta;
//     }
// 
//     @Deprecated
//     public BlockID(World world, BlockPos position) {
//         this(world.getBlockState(position));
//     }
// 
//     public BlockID(IBlockState state) {
//         this(Block.blockRegistry.getNameForObject(state.getBlock()).toString(), state.getBlock().getMetaFromState(state));
//         this.state = state;
//     }
// 
//     @Override
//     public boolean equals(Object obj)
//     {
//         if (this == obj)
//             return true;
//         
//         if (!(obj instanceof BlockID))
//             return false;
// 
//         BlockID o = (BlockID) obj;
//         return name.equals(o.name) && metadata == o.metadata;
//     }
// 
//     /**
//      * Compare the objects using the metadata value of -1 to be a wildcard that matches all.
//      * @param obj The object to compare to this one
//      * @return Whether this object and obj are equal, using the wildcard value.
//      */
//     public boolean wildcardEquals(Object obj)
//     {
//         if (this == obj)
//             return true;
// 
//         if (!(obj instanceof BlockID))
//             return false;
// 
//         BlockID o = (BlockID) obj;
//         if (o.metadata == -1 || metadata == -1)
//             return this.equals(obj);
//         else
//             return name.equals(o.name) && metadata == o.metadata;
//     }
//     
//     @Override
//     public int hashCode()
//     {
//         return (this.name.hashCode() << 6) + this.metadata;
//     }
//     
//     @Override
//     public String toString()
//     {
//         return (metadata == -1 ? name + "" : name + "/" + metadata);
//     }
// 
//     @Override
//     public int compareTo(BlockID blockID) {
//         if(name != null && !name.equals(blockID.name)) {
//             int result = name.compareTo(blockID.name);
//             if(result > 0) return 1;
//             else if (result < 0) return -1;
//             return 0;
//         }
//         else if(metadata < blockID.metadata) {
//             return -1;
//         }
//         else if(metadata > blockID.metadata) {
//             return 1;
//         }
//         else {
//             return 0;
//         }
//     }
// }


// Path: src/main/java/portablejim/veinminer/configuration/Tool.java
import portablejim.veinminer.configuration.json.ToolStruct;
import portablejim.veinminer.util.BlockID;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

package portablejim.veinminer.configuration;



/**
 * Class to manage tool tool lists and block lists.
 */
public class Tool {
    public String name;
    public String icon;
    public Set<String> toollist;
    public Set<BlockID> blocklist;

    public Tool(String name, String icon, String[] toollist, String[] blocklist) {
	    this.name = name;
	    this.icon = icon;
        this.toollist = new HashSet<String>(toollist.length);
        this.blocklist = new HashSet<BlockID>(blocklist.length);
	    Collections.addAll(this.toollist, toollist);
	    for(String block : blocklist) {
	        this.blocklist.add(new BlockID(block));
	    }
    }

    public Tool(ToolStruct baseTool) {