Interface FilteringSlot
- All Superinterfaces:
Inventory,Slot,ValueContainer
- All Known Subinterfaces:
EquipmentSlot,FuelSlot,InputSlot,PotionSlot
An inventory slot which can only accept certain types of item.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.spongepowered.api.item.inventory.Inventory
Inventory.Builder -
Method Summary
Modifier and TypeMethodDescriptionbooleanisValidItem(ItemStackLike stack) Check whether the supplied item can be inserted into this slot.booleanisValidItem(ItemType type) Check whether the supplied item can be inserted into this slot.Methods inherited from interface org.spongepowered.api.item.inventory.Inventory
asViewable, canFit, capacity, children, clear, contains, contains, containsAny, containsChild, containsInventory, freeCapacity, get, get, hasChildren, intersect, offer, offer, parent, peek, peekAt, poll, poll, pollFrom, pollFrom, query, query, query, query, query, query, root, set, slot, slots, totalQuantity, unionMethods inherited from interface org.spongepowered.api.item.inventory.Slot
set, viewedSlot
-
Method Details
-
isValidItem
Check whether the supplied item can be inserted into this slot. Returning false from this method implies thatInventory.offer(org.spongepowered.api.item.inventory.ItemStackLike...)would always return false for this item.- Parameters:
stack- ItemStackLike to check- Returns:
- true if the stack is valid for this slot
-
isValidItem
Check whether the supplied item can be inserted into this slot. Returning false from this method implies thatInventory.offer(org.spongepowered.api.item.inventory.ItemStackLike...)would always return false for items of this type.- Parameters:
type- ItemType to check- Returns:
- true if the item type is valid for this slot
-