Container
Link to container
导入类
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.world.Container;
已实现的接口
Link to 已实现的接口
Container implements the following interfaces. That means all methods defined in these interfaces are also available in Container
使用方式
Link to 使用方式
Name: canPlaceItem
Return Type: boolean
ZenScript CopyContainer.canPlaceItem(index as int, stack as ItemStack) as boolean
参数 | 类型 | 描述 |
---|---|---|
参数 index | 类型 int | 描述 No Description Provided |
参数 堆叠 | 类型 物品应用 | 描述 No Description Provided |
Name: countItem
Return Type: int
ZenScript CopyContainer.countItem(item as ItemDefinition) as int
参数 | 类型 | 描述 |
---|---|---|
参数 item | 类型 ItemDefinition | 描述 No Description Provided |
Name: countStack
Return Type: int
ZenScript CopyContainer.countStack(item as IItemStack) as int
参数 | 类型 | 描述 |
---|---|---|
参数 item | 类型 IItemstack | 描述 No Description Provided |
Name: getContainerSize
Gets the size (how many slots) of this Container
Returns: The amount of slots this Container has.
Return Type: int
ZenScript Copy// Container.getContainerSize() as int
myContainer.getContainerSize();
Name: getItem
Gets the ItemStack in the given slot.
Returns: the ItemStack in the given slot.
Return Type: ItemStack
ZenScript CopyContainer.getItem(index as int) as ItemStack
参数 | 类型 | 描述 |
---|---|---|
参数 index | 类型 int | 描述 The slot index to get. |
Name: getMaxStackSize
Return Type: int
ZenScript Copy// Container.getMaxStackSize() as int
myContainer.getMaxStackSize();
Name: hasAnyOf
Return Type: boolean
ZenScript CopyContainer.hasAnyOf(items as Set<ItemDefinition>) as boolean
参数 | 类型 | 描述 |
---|---|---|
参数 items | 类型 Set<ItemDefinition> | 描述 No Description Provided |
Name: isEmpty
Checks if this Container is empty.
Returns: True if empty. False otherwise.
Return Type: boolean
ZenScript Copy// Container.isEmpty() as boolean
myContainer.isEmpty();
Name: removeItem
Return Type: ItemStack
ZenScript CopyContainer.removeItem(var1 as int, var2 as int) as ItemStack
参数 | 类型 | 描述 |
---|---|---|
参数 var1 | 类型 int | 描述 No Description Provided |
参数 var2 | 类型 int | 描述 No Description Provided |
Name: removeItemNoUpdate
Return Type: ItemStack
ZenScript CopyContainer.removeItemNoUpdate(index as int) as ItemStack
参数 | 类型 | 描述 |
---|---|---|
参数 index | 类型 int | 描述 No Description Provided |
Name: setChanged
Return Type: void
ZenScript Copy// Container.setChanged() as void
myContainer.setChanged();
Name: setItem
Return Type: void
ZenScript CopyContainer.setItem(index as int, stack as ItemStack) as void
参数 | 类型 | 描述 |
---|---|---|
参数 index | 类型 int | 描述 No Description Provided |
参数 堆叠 | 类型 物品应用 | 描述 No Description Provided |
Name: startOpen
Return Type: void
ZenScript CopyContainer.startOpen(player as Player) as void
参数 | 类型 | 描述 |
---|---|---|
参数 player | 类型 Player | 描述 No Description Provided |
Name: stillValid
Return Type: boolean
ZenScript CopyContainer.stillValid(player as Player) as boolean
参数 | 类型 | 描述 |
---|---|---|
参数 player | 类型 Player | 描述 No Description Provided |
Name: stopOpen
Return Type: void
ZenScript CopyContainer.stopOpen(player as Player) as void
参数 | 类型 | 描述 |
---|---|---|
参数 player | 类型 Player | 描述 No Description Provided |
名称 | 类型 | 可获得 | 可设置 | 描述 |
---|---|---|---|---|
名称 changed | 类型 void | 可获得 true | 可设置 false | 描述 No Description Provided |
名称 containerSize | 类型 int | 可获得 true | 可设置 false | 描述 Gets the size (how many slots) of this Container |
名称 isEmpty #是否为空 | 类型 布尔值 | 可获得 true | 可设置 false | 描述 Checks if this Container is empty. |
名称 maxStackSize | 类型 int | 可获得 true | 可设置 false | 描述 No Description Provided |