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 correspondingBlockTypeof this item if one exists.java.util.Optional<ItemType>container()Gets the container item of this item if one exists.booleanisAnyOf(java.util.function.Supplier<? extends ItemType>... types)Returns true if this type is any of the given item typesbooleanisAnyOf(ItemType... types)Returns true if this type is any of the given item typesintmaxStackQuantity()Gets the default maximum quantity forItemStacks of this item.ItemRarityrarity()Gets the defaultItemRarityfor 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 correspondingBlockTypeof 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.BUCKETforItemTypes.WATER_BUCKET- Returns:
- The container item.
-
maxStackQuantity
int maxStackQuantity()
Gets the default maximum quantity forItemStacks of this item.- Returns:
- Max stack quantity
-
rarity
ItemRarity rarity()
Gets the defaultItemRarityfor 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
-
-