- All Known Subinterfaces:
AnvilInventory,BarrelInventory,BeaconInventory,BrewingInventory,ChestInventory,ContainerInventory,CraftingGrid,CreatureInventory,EnchantInventory,FurnaceInventory,HopperInventory,PlayerInventory,ShulkerBoxInventory
public interface Inventory
author: MagicDroidX
Nukkit Project
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleancanAddItem(ItemStack item)default booleanclear(int index)booleanclear(int index, boolean send)voidclearAll()voidbooleanvoiddecrementCount(int slot)Decrease item count in the given slotdefault intintSearch for the first occurrence of target itemintSearch for the first empty slotdefault intintReturns the first slot where item fits tointSearch for the first slot containing an itemintgetFreeSpace(ItemStack item)Returns how much space remains for the target item@NonNull ItemStackgetItem(int index)intgetName()intgetSize()getTitle()@NonNull InventoryTypegetType()voidincrementCount(int slot)Increase item count in the given slotbooleanisEmpty()booleanisFull()voidvoidvoidonSlotChange(int index, ItemStack before, boolean send)booleanvoidremoveItem(ItemStack... slots)default voidsendContents(Collection<? extends Player> players)default voidsendContents(Player player)voidsendContents(Player... players)default voidsendSlot(int index, Collection<? extends Player> players)default voidvoidvoidsetContents(Map<Integer,ItemStack> items)default booleanbooleanvoidsetMaxStackSize(int size)
-
Field Details
-
MAX_STACK
static final int MAX_STACK- See Also:
- Constant Field Values
-
-
Method Details
-
getSize
int getSize() -
getMaxStackSize
int getMaxStackSize() -
setMaxStackSize
void setMaxStackSize(int size) -
getName
String getName() -
getTitle
String getTitle() -
getItem
-
setItem
-
setItem
-
addItem
-
canAddItem
-
removeItem
-
getContents
-
setContents
-
sendContents
-
sendContents
-
sendContents
-
sendSlot
-
sendSlot
-
sendSlot
-
contains
-
all
-
first
-
first
Search for the first occurrence of target item- Parameters:
item- target itemexact- if true the item count will be must match- Returns:
- the first index containing the item
-
firstFit
-
firstFit
Returns the first slot where item fits to- Parameters:
item- item to search forsingle- if false the item count will be used. Otherwise it'll be 1- Returns:
- the first slot index that item fits to
-
firstEmpty
int firstEmpty()Search for the first empty slot- Returns:
- the first slot index
-
firstNonEmpty
int firstNonEmpty()Search for the first slot containing an item- Returns:
- the first non-empty slot
-
getFreeSpace
Returns how much space remains for the target item- Parameters:
item- target item- Returns:
- amount if free space
-
decrementCount
void decrementCount(int slot)Decrease item count in the given slot- Parameters:
slot- target slot index
-
incrementCount
void incrementCount(int slot)Increase item count in the given slot- Parameters:
slot- target slot index
-
remove
-
clear
default boolean clear(int index) -
clear
boolean clear(int index, boolean send) -
clearAll
void clearAll() -
isFull
boolean isFull() -
isEmpty
boolean isEmpty() -
getViewers
-
getType
@NonNull InventoryType getType() -
getHolder
InventoryHolder getHolder() -
onOpen
-
open
-
close
-
onClose
-
onSlotChange
-