@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 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); } }
@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 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); } }
@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); }