Package net.minestom.server.inventory
Interface InventoryModifier
- All Known Implementing Classes:
AnvilInventory
,BeaconInventory
,BrewingStandInventory
,EnchantmentTableInventory
,FurnaceInventory
,Inventory
,PlayerInventory
,VillagerInventory
public interface InventoryModifier
Represents an inventory where items can be modified/retrieved.
-
Method Summary
Modifier and Type Method Description void
addInventoryCondition(InventoryCondition inventoryCondition)
Adds a newInventoryCondition
to this inventory.boolean
addItemStack(ItemStack itemStack)
Adds anItemStack
to the inventory and send relevant update to the viewer(s).void
clear()
Clears the inventory and send relevant update to the viewer(s).java.util.List<InventoryCondition>
getInventoryConditions()
Gets all theInventoryCondition
of this inventory.ItemStack
getItemStack(int slot)
Gets theItemStack
at the specified slot.ItemStack[]
getItemStacks()
Gets all theItemStack
in the inventory.int
getSize()
Gets the size of the inventory.void
setItemStack(int slot, ItemStack itemStack)
Sets anItemStack
at the specified slot and send relevant update to the viewer(s).
-
Method Details
-
setItemStack
Sets anItemStack
at the specified slot and send relevant update to the viewer(s).- Parameters:
slot
- the slot to set the itemitemStack
- the item to set
-
addItemStack
Adds anItemStack
to the inventory and send relevant update to the viewer(s).Even the item cannot be fully added, the amount of
itemStack
will be updated.- Parameters:
itemStack
- the item to add- Returns:
- true if the item has been successfully fully added, false otherwise
-
clear
void clear()Clears the inventory and send relevant update to the viewer(s). -
getItemStack
Gets theItemStack
at the specified slot.- Parameters:
slot
- the slot to check- Returns:
- the item in the slot
slot
-
getItemStacks
Gets all theItemStack
in the inventory.- Returns:
- an array containing all the inventory's items
-
getSize
int getSize()Gets the size of the inventory.- Returns:
- the inventory's size
-
getInventoryConditions
Gets all theInventoryCondition
of this inventory.- Returns:
- a modifiable
List
containing all the inventory conditions
-
addInventoryCondition
Adds a newInventoryCondition
to this inventory.- Parameters:
inventoryCondition
- the inventory condition to add
-