Package org.spongepowered.api.item
Interface ItemType
-
- All Superinterfaces:
ComponentLike
,DataHolder
,DataHolder.Immutable<ItemType>
,DefaultedRegistryValue
,Taggable<ItemType>
,ValueContainer
@CatalogedBy(ItemTypes.class) public interface ItemType extends DefaultedRegistryValue, ComponentLike, DataHolder.Immutable<ItemType>, Taggable<ItemType>
A type of item.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.spongepowered.api.data.DataHolder
DataHolder.Immutable<I extends DataHolder.Immutable<I>>, DataHolder.Mutable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Optional<BlockType>
block()
Gets the correspondingBlockType
of this item if one exists.java.util.Optional<ItemType>
container()
Gets the container item of this item if one exists.boolean
isAnyOf(java.util.function.Supplier<? extends ItemType>... types)
Returns true if this type is any of the given item typesboolean
isAnyOf(ItemType... types)
Returns true if this type is any of the given item typesint
maxStackQuantity()
Gets the default maximum quantity forItemStack
s of this item.ItemRarity
rarity()
Gets the defaultItemRarity
for thisItemType
.-
Methods inherited from interface net.kyori.adventure.text.ComponentLike
asComponent
-
Methods inherited from interface org.spongepowered.api.data.DataHolder.Immutable
mergeWith, mergeWith, transform, transform, with, with, with, without, without, without
-
Methods inherited from interface org.spongepowered.api.registry.DefaultedRegistryValue
asDefaultedReference, findKey, key
-
-
-
-
Method Detail
-
block
java.util.Optional<BlockType> block()
Gets the correspondingBlockType
of this item if one exists.- Returns:
- The Block
-
container
java.util.Optional<ItemType> container()
Gets the container item of this item if one exists.e.g.
ItemTypes.BUCKET
forItemTypes.WATER_BUCKET
- Returns:
- The container item.
-
maxStackQuantity
int maxStackQuantity()
Gets the default maximum quantity forItemStack
s of this item.- Returns:
- Max stack quantity
-
rarity
ItemRarity rarity()
Gets the defaultItemRarity
for thisItemType
.- Returns:
- The default rarity for the item type.
-
isAnyOf
boolean isAnyOf(java.util.function.Supplier<? extends ItemType>... types)
Returns true if this type is any of the given item types- Parameters:
types
- the item types to check- Returns:
- true if this type is any of the given item types
-
isAnyOf
boolean isAnyOf(ItemType... types)
Returns true if this type is any of the given item types- Parameters:
types
- the item types to check- Returns:
- true if this type is any of the given item types
-
-