예제 #1
0
 @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()));
 }
예제 #2
0
 @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;
 }
예제 #3
0
 @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);
 }
예제 #4
0
 @Override
 public IItemStack withDamage(int damage) {
   if (stack.getItem().getHasSubtypes()) {
     MineTweakerAPI.logWarning("subitems don't have damaged states");
     return this;
   } else {
     ItemStack result = new ItemStack(stack.getItem(), stack.getCount(), damage);
     result.setTagCompound(stack.getTagCompound());
     return new MCItemStack(result, tag);
   }
 }
예제 #5
0
  @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);
  }
예제 #6
0
 @Override
 public IIngredient anyDamage() {
   if (stack.getItem().getHasSubtypes()) {
     MineTweakerAPI.logWarning("subitems don't have damaged states");
     return this;
   } else {
     ItemStack result =
         new ItemStack(stack.getItem(), stack.getCount(), OreDictionary.WILDCARD_VALUE);
     result.setTagCompound(stack.getTagCompound());
     return new MCItemStack(result, tag);
   }
 }
예제 #7
0
 @Override
 public int getAmount() {
   return stack.getCount();
 }