Inventory
Link to inventory
导入类
Link to 导入类
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport crafttweaker.api.entity.type.player.Inventory;
已实现的接口
Link to 已实现的接口
Inventory implements the following interfaces. That means all methods defined in these interfaces are also available in Inventory
使用方式
Link to 使用方式
Name: add
Return Type: boolean
ZenScript CopyInventory.add(stack as ItemStack) as boolean
参数 | 类型 |
---|---|
参数 堆叠 | 类型 物品应用 |
Name: add
Return Type: boolean
ZenScript CopyInventory.add(index as int, stack as ItemStack) as boolean
参数 | 类型 |
---|---|
参数 index | 类型 int |
参数 堆叠 | 类型 物品应用 |
Name: contains
Return Type: boolean
ZenScript CopyInventory.contains(stack as ItemStack) as boolean
参数 | 类型 |
---|---|
参数 堆叠 | 类型 物品应用 |
Name: contains
Return Type: boolean
ZenScript CopyInventory.contains(tag as KnownTag<ItemDefinition>) as boolean
参数 | 类型 |
---|---|
参数 tag #标签 | 类型 KnownTag<ItemDefinition> |
Name: dropAll
ZenScript Copy// Inventory.dropAll()
myInventory.dropAll();
Name: findSlotMatchingItem
Return Type: int
ZenScript CopyInventory.findSlotMatchingItem(stack as ItemStack) as int
参数 | 类型 |
---|---|
参数 堆叠 | 类型 物品应用 |
Name: findSlotMatchingUnusedItem
Return Type: int
ZenScript CopyInventory.findSlotMatchingUnusedItem(stack as ItemStack) as int
参数 | 类型 |
---|---|
参数 堆叠 | 类型 物品应用 |
Name: getArmor
Return Type: ItemStack
ZenScript CopyInventory.getArmor(armorIndex as int) as ItemStack
参数 | 类型 |
---|---|
参数 armorIndex | 类型 int |
Name: getFreeSlot
Return Type: int
ZenScript Copy// Inventory.getFreeSlot() as int
myInventory.getFreeSlot();
Name: getSelected
Return Type: ItemStack
ZenScript Copy// Inventory.getSelected() as ItemStack
myInventory.getSelected();
Name: getSlotWithRemainingSpace
Return Type: int
ZenScript CopyInventory.getSlotWithRemainingSpace(stack as ItemStack) as int
参数 | 类型 |
---|---|
参数 堆叠 | 类型 物品应用 |
Name: getSuitableHotbarSlot
Return Type: int
ZenScript Copy// Inventory.getSuitableHotbarSlot() as int
myInventory.getSuitableHotbarSlot();
Name: getTimesChanged
Return Type: int
ZenScript Copy// Inventory.getTimesChanged() as int
myInventory.getTimesChanged();
Name: hurtArmor
ZenScript CopyInventory.hurtArmor(source as DamageSource, damage as float, armorSlots as int[])
参数 | 类型 |
---|---|
参数 来源 | 类型 DamageSource |
参数 damage | 类型 float |
参数 armorSlots | 类型 整型[] |
Name: pickSlot
ZenScript CopyInventory.pickSlot(index as int)
参数 | 类型 |
---|---|
参数 index | 类型 int |
名称 | 类型 | 可获得 | 可设置 |
---|---|---|---|
名称 freeSlot | 类型 int | 可获得 true | 可设置 false |
名称 selected | 类型 物品应用 | 可获得 true | 可设置 false |
名称 suitableHotbarSlot | 类型 int | 可获得 true | 可设置 false |
名称 timesChanged | 类型 int | 可获得 true | 可设置 false |