Link to imutableitemstack
A mutable ItemStack.
damageItem etc. Changes (such as count or tag changes) will modify and return the ItemStack itself instead of a new ItemStack with the changed properties.
Importing the package
Link to importing-the-package
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import.
Getting the Instance
Link to getting-the-instance
You can get a IMutableItemStack by using IItemStack's
mutable() method. like so:
Extending the IItemStack
Link to extending-the-iitemstack
IMutableItemStack extends IItemStack and is able to call all of its methods/getters/setters as well.
Link to zenmethods
Link to quantity
withAmount, you can easily call these methods below to change the count of item.
DescriptionIncreases the stack's count by the
DescriptionDecreases the stack's count by the
Link to damaging
The method attempts to damage the stack with an optional player. Returns if the stack is damaged successfully.
boolean attemptDamageItem(int amount, @Optional IPlayer player);
Link to copying
The copy method will returns a new immutable ItemStack with the same properties. If you are certain that the stack shouldn't be changed anymore and want to avoid unexpected item changes, you will need to use the method.