ContainerSingleItem

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.api.world.ContainerSingleItem;

Implements

ContainerSingleItem implements the following interfaces:

Container,Clearable

Members

canPlaceItem(index as int, stack as ItemStack) as bool
script.zs
// ContainerSingleItem.canPlaceItem(index as int, stack as ItemStack) as bool;
myContainerSingleItem.canPlaceItem(myInt, myItemStack);

Parameters:

index Type: int
stack Type: ItemStack

Return Type: bool

Getter
script.zs
// ContainerSingleItem.changed
myContainerSingleItem.changed
changed()
script.zs
// ContainerSingleItem.changed();
myContainerSingleItem.changed();
clearContent()
Clears the contents of this Clearable.
script.zs
// ContainerSingleItem.clearContent();
myContainerSingleItem.clearContent();
Getter
Gets the size (how many slots) of this Container
script.zs
// ContainerSingleItem.containerSize as int
myContainerSingleItem.containerSize

Return Type: int

containerSize() as int
Gets the size (how many slots) of this Container

Returns: The amount of slots this Container has.

script.zs
// ContainerSingleItem.containerSize() as int;
myContainerSingleItem.containerSize();

Return Type: int

countItem(item as Item) as int
script.zs
// ContainerSingleItem.countItem(item as ItemDefinition) as int;
myContainerSingleItem.countItem(myItem);

Parameters:

Return Type: int

countStack(item as IItemStack) as int
script.zs
// ContainerSingleItem.countStack(item as IItemStack) as int;
myContainerSingleItem.countStack(myIItemStack);

Parameters:

item Type: IItemStack

Return Type: int

getItem(index as int) as ItemStack
Gets the ItemStack in the given slot.

Returns: the ItemStack in the given slot.

script.zs
// ContainerSingleItem.getItem(index as int) as ItemStack;
myContainerSingleItem.getItem(myInt);

Parameters:

index Type: int - The slot index to get.

Return Type: ItemStack

getTheItem() as ItemStack
Gets the only item held by the container.

Returns: The item held by the container.

script.zs
// ContainerSingleItem.getTheItem() as ItemStack;
myContainerSingleItem.getTheItem();

Return Type: ItemStack

hasAnyOf(items as Set<Item>) as bool
script.zs
// ContainerSingleItem.hasAnyOf(items as Set<ItemDefinition>) as bool;
myContainerSingleItem.hasAnyOf(mySet);

Parameters:

items Type: Set<ItemDefinition>

Return Type: bool

Getter
Checks if this Container is empty.
script.zs
// ContainerSingleItem.isEmpty as bool
myContainerSingleItem.isEmpty

Return Type: bool

isEmpty() as bool
Checks if this Container is empty.

Returns: True if empty. False otherwise.

script.zs
// ContainerSingleItem.isEmpty() as bool;
myContainerSingleItem.isEmpty();

Return Type: bool

Getter
script.zs
// ContainerSingleItem.maxStackSize as int
myContainerSingleItem.maxStackSize

Return Type: int

maxStackSize() as int
script.zs
// ContainerSingleItem.maxStackSize() as int;
myContainerSingleItem.maxStackSize();

Return Type: int

removeItem(var1 as int, var2 as int) as ItemStack
script.zs
// ContainerSingleItem.removeItem(var1 as int, var2 as int) as ItemStack;
myContainerSingleItem.removeItem(myInt, myInt);

Parameters:

var1 Type: int
var2 Type: int

Return Type: ItemStack

removeItemNoUpdate(index as int) as ItemStack
script.zs
// ContainerSingleItem.removeItemNoUpdate(index as int) as ItemStack;
myContainerSingleItem.removeItemNoUpdate(myInt);

Parameters:

index Type: int

Return Type: ItemStack

setItem(index as int, stack as ItemStack)
script.zs
// ContainerSingleItem.setItem(index as int, stack as ItemStack);
myContainerSingleItem.setItem(myInt, myItemStack);

Parameters:

index Type: int
stack Type: ItemStack
setTheItem(stack as ItemStack)
Sets the only item held by the container.
script.zs
// ContainerSingleItem.setTheItem(stack as ItemStack);
myContainerSingleItem.setTheItem(myItemStack);

Parameters:

stack Type: ItemStack - The new item for te container to hold.
splitTheItem(amount as int) as ItemStack
Removes up to the specified amount of the contained item.

Returns: The item that was split from the contained item.

script.zs
// ContainerSingleItem.splitTheItem(amount as int) as ItemStack;
myContainerSingleItem.splitTheItem(myInt);

Parameters:

amount Type: int - The maximum amount of the item to split off from the contained item.

Return Type: ItemStack

startOpen(player as Player)
script.zs
// ContainerSingleItem.startOpen(player as Player);
myContainerSingleItem.startOpen(myPlayer);

Parameters:

player Type: Player
stillValid(player as Player) as bool
script.zs
// ContainerSingleItem.stillValid(player as Player) as bool;
myContainerSingleItem.stillValid(myPlayer);

Parameters:

player Type: Player

Return Type: bool

stopOpen(player as Player)
script.zs
// ContainerSingleItem.stopOpen(player as Player);
myContainerSingleItem.stopOpen(myPlayer);

Parameters:

player Type: Player