@CatalogedBy(value=ItemTypes.class) public interface ItemType extends CatalogType, Translatable, GameDictionary.Entry
| Modifier and Type | Method and Description |
|---|---|
Optional<BlockType> |
getBlock()
Gets the corresponding
BlockType of this item if one exists. |
Optional<ItemType> |
getContainer()
Gets the container item of this item if one exists.
|
<T extends Property<?,?>> |
getDefaultProperty(Class<T> propertyClass)
|
int |
getMaxStackQuantity()
Gets the default maximum quantity for
ItemStacks of this item. |
String |
getName()
Gets the id of this item.
|
default ItemStackSnapshot |
getTemplate()
Returns an item stack snapshot for plugins to inspect this entry.
|
default ItemType |
getType()
Returns the type of item contained by this entry.
|
default boolean |
isSpecific()
Returns whether this entry checks against the item type and extra
data associated with the stack.
|
default boolean |
matches(ItemStack stack)
Tests whether the provided item stack matches this entry's
specifications.
|
getIdgetTranslationOptional<BlockType> getBlock()
BlockType of this item if one exists.Optional<ItemType> getContainer()
e.g. ItemTypes.BUCKET for ItemTypes.WATER_BUCKET
String getName()
Ex. Minecraft registers a golden carrot as "minecraft:golden_carrot".
getName in interface CatalogTypeint getMaxStackQuantity()
ItemStacks of this item.<T extends Property<?,?>> Optional<T> getDefaultProperty(Class<T> propertyClass)
Property of this ItemType.
While item stacks do have properties, generally, there is an intrinsic default property for many item types. However, it should be considered that when mods are introducing their own custom items, they too could introduce different item properties based on various data on the item stack. The default properties retrieved from here should merely be considered as a default, not as a definitive property.
T - The type of item propertypropertyClass - The item property classdefault ItemType getType()
GameDictionary.EntrygetType in interface GameDictionary.Entrydefault boolean matches(ItemStack stack)
GameDictionary.Entrymatches in interface GameDictionary.Entrystack - The item stack to testtrue if the stack matches this entrydefault boolean isSpecific()
GameDictionary.Entrytrue, any
ItemStack whose ItemType and manipulators match
those of the template will match this entry; however, not all manipulators
present in the template are required to match those in the item
stack to cause them to match. If this returns false, any
item stack whose ItemType matches that of the entry will
match this entry.isSpecific in interface GameDictionary.Entrytrue if the entry checks extra data on the stackdefault ItemStackSnapshot getTemplate()
GameDictionary.EntrygetTemplate in interface GameDictionary.Entry