public interface ItemStack extends DataHolder, DataSerializable, TextRepresentable, Translatable
ItemType
. Supports serialization and
can be compared using the comparators listed in ItemStackComparators
.
ItemStack
s have varying properties and data, it is adviseable to
use CompositeValueStore.get(Class)
to retrieve different information
regarding this item stack.
Modifier and Type | Method and Description |
---|---|
ItemStack |
copy()
Creates a clone copy of this
ValueContainer as a new
ValueContainer such that all the BaseValue s are
safely duplicated to the new instance. |
ItemStackSnapshot |
createSnapshot()
Gets the
ItemStackSnapshot of this ItemStack . |
ItemType |
getItem()
|
int |
getMaxStackQuantity()
Get the maximum quantity per stack.
|
int |
getQuantity()
Gets the quantity of items in this stack.
|
void |
setQuantity(int quantity)
Sets the quantity in this stack.
|
setRawData, validateRawData
toContainer
getApplicableProperties, getProperty
copyFrom, copyFrom, get, getContainers, getOrCreate, offer, offer, offer, offer, offer, offer, remove, remove, remove, supports, transform, undo
get, getKeys, getOrElse, getOrNull, getValue, getValues, supports, supports
toText
getTranslation
ItemType getItem()
int getQuantity()
void setQuantity(int quantity) throws IllegalArgumentException
quantity
- QuantityIllegalArgumentException
- If quantity set exceeds the
getMaxStackQuantity()
int getMaxStackQuantity()
ItemType.getMaxStackQuantity()
, unless a
different value has been set for this specific stack.ItemStackSnapshot createSnapshot()
ItemStackSnapshot
of this ItemStack
. All known
DataManipulator
s existing on this ItemStack
are added
as copies to the ItemStackSnapshot
.ItemStack copy()
ValueContainer
ValueContainer
as a new
ValueContainer
such that all the BaseValue
s are
safely duplicated to the new instance.copy
in interface ValueContainer<DataHolder>