@Override
 public boolean matches(IItemStack item) {
   ItemStack internal = getItemStack(item);
   return internal != null
       && stack != null
       && internal.getItem() == stack.getItem()
       && (wildcardSize || internal.getCount() >= stack.getCount())
       && (stack.getItemDamage() == OreDictionary.WILDCARD_VALUE
           || stack.getItemDamage() == internal.getItemDamage()
           || (!stack.getHasSubtypes() && !stack.getItem().isDamageable()));
 }
  @Override
  public List<IOreDictEntry> getOres() {
    List<IOreDictEntry> result = new ArrayList<>();

    for (String key : OreDictionary.getOreNames()) {
      for (ItemStack is : OreDictionary.getOres(key)) {
        if (is.getItem() == stack.getItem()
            && (is.getItemDamage() == OreDictionary.WILDCARD_VALUE
                || is.getItemDamage() == stack.getItemDamage())) {
          result.add(MineTweakerAPI.oreDict.get(key));
          break;
        }
      }
    }

    return result;
  }
 @Override
 public int hashCode() {
   int hash = 7;
   hash = 41 * hash + stack.getItem().hashCode();
   hash = 41 * hash + stack.getItemDamage();
   hash = 41 * hash + stack.getCount();
   hash = 41 * hash + (stack.getTagCompound() == null ? 0 : stack.getTagCompound().hashCode());
   hash = 41 * hash + (this.wildcardSize ? 1 : 0);
   return hash;
 }
 @Override
 public IItemStack withTag(IData tag) {
   ItemStack result = new ItemStack(stack.getItem(), stack.getCount(), stack.getItemDamage());
   if (tag == null) {
     result.setTagCompound(null);
   } else {
     result.setTagCompound((NBTTagCompound) NBTConverter.from(tag));
   }
   return new MCItemStack(result, tag);
 }
  @Override
  public String toString() {
    StringBuilder result = new StringBuilder();
    result.append('<');
    result.append(Item.REGISTRY.getNameForObject(stack.getItem()));

    if (stack.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
      result.append(":*");
    } else if (stack.getItemDamage() > 0) {
      result.append(':').append(stack.getItemDamage());
    }
    result.append('>');

    if (stack.getTagCompound() != null) {
      result.append(".withTag(");
      result.append(NBTConverter.from(stack.getTagCompound(), wildcardSize).toString());
      result.append(")");
    }

    return result.toString();
  }
  @Override
  public IItemStack removeTag(String tag) {
    ItemStack result = new ItemStack(stack.getItem(), stack.getCount(), stack.getItemDamage());

    if (tag == null) {
      result.setTagCompound(null);
    } else {
      result.getTagCompound().removeTag(tag);
    }
    IData dataTag = NBTConverter.from(result.getTagCompound(), false);
    return new MCItemStack(result, dataTag);
  }
 @Override
 public IItemStack withAmount(int amount) {
   ItemStack result = new ItemStack(stack.getItem(), amount, stack.getItemDamage());
   result.setTagCompound(stack.getTagCompound());
   return new MCItemStack(result, tag);
 }
 @Override
 public IItemStack anyAmount() {
   ItemStack result = new ItemStack(stack.getItem(), 1, stack.getItemDamage());
   result.setTagCompound(stack.getTagCompound());
   return new MCItemStack(result, tag, true);
 }
 @Override
 public int getDamage() {
   return stack.getItemDamage();
 }