Class BaseInventory
java.lang.Object
org.cloudburstmc.server.inventory.BaseInventory
- All Implemented Interfaces:
org.cloudburstmc.api.inventory.Inventory
- Direct Known Subclasses:
CloudAnvilInventory,CloudBeaconInventory,CloudContainer,CloudCraftingGrid,CloudCreatureInventory,CloudEnchantInventory,PlayerCursorInventory
public abstract class BaseInventory
extends Object
implements org.cloudburstmc.api.inventory.Inventory
author: MagicDroidX
Nukkit Project
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.cloudburstmc.api.inventory.InventoryHolderprotected intprotected Stringprotected intit.unimi.dsi.fastutil.ints.Int2ObjectMap<org.cloudburstmc.api.item.ItemStack>protected Stringprotected org.cloudburstmc.api.inventory.InventoryTypeprotected Set<CloudPlayer>Fields inherited from interface org.cloudburstmc.api.inventory.Inventory
MAX_STACK -
Constructor Summary
ConstructorsConstructorDescriptionBaseInventory(org.cloudburstmc.api.inventory.InventoryHolder holder, org.cloudburstmc.api.inventory.InventoryType type)BaseInventory(org.cloudburstmc.api.inventory.InventoryHolder holder, org.cloudburstmc.api.inventory.InventoryType type, Map<Integer,org.cloudburstmc.api.item.ItemStack> contents)BaseInventory(org.cloudburstmc.api.inventory.InventoryHolder holder, org.cloudburstmc.api.inventory.InventoryType type, Map<Integer,org.cloudburstmc.api.item.ItemStack> contents, Integer overrideSize)BaseInventory(org.cloudburstmc.api.inventory.InventoryHolder holder, org.cloudburstmc.api.inventory.InventoryType type, Map<Integer,org.cloudburstmc.api.item.ItemStack> contents, Integer overrideSize, String overrideTitle) -
Method Summary
Modifier and TypeMethodDescriptionorg.cloudburstmc.api.item.ItemStack[]addItem(org.cloudburstmc.api.item.ItemStack... slots)booleanaddItemToFirstEmptySlot(org.cloudburstmc.api.item.ItemStack item)all(org.cloudburstmc.api.item.ItemStack item)booleancanAddItem(org.cloudburstmc.api.item.ItemStack item)booleanclear(int index, boolean send)voidclearAll()voidclose(org.cloudburstmc.api.player.Player who)booleancontains(org.cloudburstmc.api.item.ItemStack item)voiddecrementCount(int slot)intfirst(org.cloudburstmc.api.item.ItemStack item, boolean exact)intintfirstFit(org.cloudburstmc.api.item.ItemStack item, boolean single)intprotected intintgetFreeSpace(org.cloudburstmc.api.item.ItemStack item)org.cloudburstmc.api.inventory.InventoryHolder@NonNull CloudItemStackgetItem(int index)intgetName()intgetSize()getTitle()org.cloudburstmc.api.inventory.InventoryTypegetType()voidincrementCount(int slot)booleanisEmpty()booleanisFull()voidonClose(org.cloudburstmc.api.player.Player who)voidonOpen(org.cloudburstmc.api.player.Player who)voidonSlotChange(int index, org.cloudburstmc.api.item.ItemStack before, boolean send)booleanopen(org.cloudburstmc.api.player.Player who)voidremove(org.cloudburstmc.api.item.ItemStack item)org.cloudburstmc.api.item.ItemStack[]removeItem(org.cloudburstmc.api.item.ItemStack... slots)voidsendContents(org.cloudburstmc.api.player.Player... players)voidsendSlot(int index, org.cloudburstmc.api.player.Player... players)voidsetContents(Map<Integer,org.cloudburstmc.api.item.ItemStack> items)booleansetItem(int index, org.cloudburstmc.api.item.ItemStack item, boolean send)voidsetMaxStackSize(int maxStackSize)voidsetSize(int size)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.cloudburstmc.api.inventory.Inventory
clear, first, firstFit, sendContents, sendContents, sendSlot, sendSlot, setItem
-
Field Details
-
type
protected final org.cloudburstmc.api.inventory.InventoryType type -
maxStackSize
protected int maxStackSize -
size
protected int size -
name
-
title
-
slots
public final it.unimi.dsi.fastutil.ints.Int2ObjectMap<org.cloudburstmc.api.item.ItemStack> slots -
viewers
-
holder
protected org.cloudburstmc.api.inventory.InventoryHolder holder
-
-
Constructor Details
-
BaseInventory
public BaseInventory(org.cloudburstmc.api.inventory.InventoryHolder holder, org.cloudburstmc.api.inventory.InventoryType type) -
BaseInventory
-
BaseInventory
-
BaseInventory
-
-
Method Details
-
getSize
public int getSize()- Specified by:
getSizein interfaceorg.cloudburstmc.api.inventory.Inventory
-
setSize
public void setSize(int size) -
getMaxStackSize
public int getMaxStackSize()- Specified by:
getMaxStackSizein interfaceorg.cloudburstmc.api.inventory.Inventory
-
getName
- Specified by:
getNamein interfaceorg.cloudburstmc.api.inventory.Inventory
-
getTitle
- Specified by:
getTitlein interfaceorg.cloudburstmc.api.inventory.Inventory
-
getItem
- Specified by:
getItemin interfaceorg.cloudburstmc.api.inventory.Inventory
-
getContents
- Specified by:
getContentsin interfaceorg.cloudburstmc.api.inventory.Inventory
-
setContents
- Specified by:
setContentsin interfaceorg.cloudburstmc.api.inventory.Inventory
-
setItem
public boolean setItem(int index, org.cloudburstmc.api.item.ItemStack item, boolean send)- Specified by:
setItemin interfaceorg.cloudburstmc.api.inventory.Inventory
-
contains
public boolean contains(org.cloudburstmc.api.item.ItemStack item)- Specified by:
containsin interfaceorg.cloudburstmc.api.inventory.Inventory
-
all
public Map<Integer,org.cloudburstmc.api.item.ItemStack> all(org.cloudburstmc.api.item.ItemStack item)- Specified by:
allin interfaceorg.cloudburstmc.api.inventory.Inventory
-
remove
public void remove(org.cloudburstmc.api.item.ItemStack item)- Specified by:
removein interfaceorg.cloudburstmc.api.inventory.Inventory
-
first
public int first(org.cloudburstmc.api.item.ItemStack item, boolean exact)- Specified by:
firstin interfaceorg.cloudburstmc.api.inventory.Inventory
-
firstEmpty
public int firstEmpty()- Specified by:
firstEmptyin interfaceorg.cloudburstmc.api.inventory.Inventory
-
firstNonEmpty
public int firstNonEmpty()- Specified by:
firstNonEmptyin interfaceorg.cloudburstmc.api.inventory.Inventory
-
firstFit
public int firstFit(org.cloudburstmc.api.item.ItemStack item, boolean single)- Specified by:
firstFitin interfaceorg.cloudburstmc.api.inventory.Inventory
-
decrementCount
public void decrementCount(int slot)- Specified by:
decrementCountin interfaceorg.cloudburstmc.api.inventory.Inventory
-
incrementCount
public void incrementCount(int slot)- Specified by:
incrementCountin interfaceorg.cloudburstmc.api.inventory.Inventory
-
canAddItem
public boolean canAddItem(org.cloudburstmc.api.item.ItemStack item)- Specified by:
canAddItemin interfaceorg.cloudburstmc.api.inventory.Inventory
-
addItem
public org.cloudburstmc.api.item.ItemStack[] addItem(org.cloudburstmc.api.item.ItemStack... slots)- Specified by:
addItemin interfaceorg.cloudburstmc.api.inventory.Inventory
-
getEmptySlotsCount
protected int getEmptySlotsCount() -
addItemToFirstEmptySlot
public boolean addItemToFirstEmptySlot(org.cloudburstmc.api.item.ItemStack item) -
removeItem
public org.cloudburstmc.api.item.ItemStack[] removeItem(org.cloudburstmc.api.item.ItemStack... slots)- Specified by:
removeItemin interfaceorg.cloudburstmc.api.inventory.Inventory
-
clear
public boolean clear(int index, boolean send)- Specified by:
clearin interfaceorg.cloudburstmc.api.inventory.Inventory
-
clearAll
public void clearAll()- Specified by:
clearAllin interfaceorg.cloudburstmc.api.inventory.Inventory
-
getViewers
- Specified by:
getViewersin interfaceorg.cloudburstmc.api.inventory.Inventory
-
getHolder
public org.cloudburstmc.api.inventory.InventoryHolder getHolder()- Specified by:
getHolderin interfaceorg.cloudburstmc.api.inventory.Inventory
-
setMaxStackSize
public void setMaxStackSize(int maxStackSize)- Specified by:
setMaxStackSizein interfaceorg.cloudburstmc.api.inventory.Inventory
-
open
public boolean open(org.cloudburstmc.api.player.Player who)- Specified by:
openin interfaceorg.cloudburstmc.api.inventory.Inventory
-
close
public void close(org.cloudburstmc.api.player.Player who)- Specified by:
closein interfaceorg.cloudburstmc.api.inventory.Inventory
-
onOpen
public void onOpen(org.cloudburstmc.api.player.Player who)- Specified by:
onOpenin interfaceorg.cloudburstmc.api.inventory.Inventory
-
onClose
public void onClose(org.cloudburstmc.api.player.Player who)- Specified by:
onClosein interfaceorg.cloudburstmc.api.inventory.Inventory
-
onSlotChange
public void onSlotChange(int index, org.cloudburstmc.api.item.ItemStack before, boolean send)- Specified by:
onSlotChangein interfaceorg.cloudburstmc.api.inventory.Inventory
-
sendContents
public void sendContents(org.cloudburstmc.api.player.Player... players)- Specified by:
sendContentsin interfaceorg.cloudburstmc.api.inventory.Inventory
-
isFull
public boolean isFull()- Specified by:
isFullin interfaceorg.cloudburstmc.api.inventory.Inventory
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceorg.cloudburstmc.api.inventory.Inventory
-
getFreeSpace
public int getFreeSpace(org.cloudburstmc.api.item.ItemStack item)- Specified by:
getFreeSpacein interfaceorg.cloudburstmc.api.inventory.Inventory
-
sendSlot
public void sendSlot(int index, org.cloudburstmc.api.player.Player... players)- Specified by:
sendSlotin interfaceorg.cloudburstmc.api.inventory.Inventory
-
getType
public org.cloudburstmc.api.inventory.InventoryType getType()- Specified by:
getTypein interfaceorg.cloudburstmc.api.inventory.Inventory
-