Package cn.nukkit.inventory
Class StructBlockInventory
java.lang.Object
cn.nukkit.inventory.StructBlockInventory
- All Implemented Interfaces:
Inventory
@PowerNukkitXOnly
@Since("1.19.60-r1")
public class StructBlockInventory
extends Object
implements Inventory
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionItem[]
void
addListener
(InventoryListener listener) Deprecated.boolean
canAddItem
(Item item) boolean
clear
(int index, boolean send) void
clearAll()
void
boolean
void
decreaseCount
(int slot) int
int
firstEmpty
(Item item) getItem
(int index) 获取该库存指定索引处的物品int
获取最大库存大小getName()
获取该库存的名字int
getSize()
获取该库存大小getTitle()
获取该库存的标题getType()
boolean
isEmpty()
boolean
isFull()
void
void
void
onSlotChange
(int index, Item before, boolean send) 当执行Inventory.setItem(int, Item)
时该方法会被调用,此时物品已经put进slotsboolean
void
Item[]
removeItem
(Item... slots) void
removeListener
(InventoryListener listener) Deprecated.void
sendContents
(Player player) void
sendContents
(Player... players) void
sendContents
(Collection<Player> players) void
void
void
sendSlot
(int index, Collection<Player> players) void
setContents
(Map<Integer, Item> items) boolean
设置该库存指定索引处的物品void
setMaxStackSize
(int size) 设置最大库存大小Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface cn.nukkit.inventory.Inventory
clear, first, getUnclonedItem, setItem, setItemByPlayer
-
Field Details
-
holder
-
-
Constructor Details
-
StructBlockInventory
-
-
Method Details
-
getSize
public int getSize()Description copied from interface:Inventory
获取该库存大小 -
getMaxStackSize
public int getMaxStackSize()Description copied from interface:Inventory
获取最大库存大小- Specified by:
getMaxStackSize
in interfaceInventory
-
setMaxStackSize
public void setMaxStackSize(int size) Description copied from interface:Inventory
设置最大库存大小- Specified by:
setMaxStackSize
in interfaceInventory
-
getName
Description copied from interface:Inventory
获取该库存的名字 -
getTitle
Description copied from interface:Inventory
获取该库存的标题 -
getItem
Description copied from interface:Inventory
获取该库存指定索引处的物品 -
setItem
Description copied from interface:Inventory
设置该库存指定索引处的物品 -
addItem
-
canAddItem
- Specified by:
canAddItem
in interfaceInventory
-
removeItem
- Specified by:
removeItem
in interfaceInventory
-
getContents
- Specified by:
getContents
in interfaceInventory
-
setContents
- Specified by:
setContents
in interfaceInventory
-
sendContents
- Specified by:
sendContents
in interfaceInventory
-
sendContents
- Specified by:
sendContents
in interfaceInventory
-
sendContents
- Specified by:
sendContents
in interfaceInventory
-
sendSlot
-
sendSlot
-
sendSlot
-
contains
-
all
-
first
-
firstEmpty
- Specified by:
firstEmpty
in interfaceInventory
-
decreaseCount
public void decreaseCount(int slot) - Specified by:
decreaseCount
in interfaceInventory
-
remove
-
clear
public boolean clear(int index, boolean send) -
clearAll
public void clearAll() -
isFull
public boolean isFull() -
isEmpty
public boolean isEmpty() -
getViewers
- Specified by:
getViewers
in interfaceInventory
-
getType
-
getHolder
-
onOpen
-
open
-
close
-
onClose
-
onSlotChange
Description copied from interface:Inventory
当执行Inventory.setItem(int, Item)
时该方法会被调用,此时物品已经put进slotsThis method is called when
Inventory.setItem(int, Item)
is executed, and the item has been put into slots- Specified by:
onSlotChange
in interfaceInventory
- Parameters:
index
- 物品变动的格子索引
The grid index of the item's changesbefore
- 变动前的物品
Items before the changesend
- 是否发送InventorySlotPacket
到客户端
Whether to sendInventorySlotPacket
to the client
-
addListener
Deprecated.- Specified by:
addListener
in interfaceInventory
-
removeListener
Deprecated.- Specified by:
removeListener
in interfaceInventory
-