Container

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.Container;

Implements

Container implements the following interfaces:

Clearable

Members

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

Parameters:

index Type: int
stack Type: ItemStack

Return Type: bool

Getter
script.zs
// Container.changed
myContainer.changed
changed()
script.zs
// Container.changed();
myContainer.changed();
clearContent()
Clears the contents of this Clearable.
script.zs
// Container.clearContent();
myContainer.clearContent();
Getter
Gets the size (how many slots) of this Container
script.zs
// Container.containerSize as int
myContainer.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
// Container.containerSize() as int;
myContainer.containerSize();

Return Type: int

countItem(item as Item) as int
script.zs
// Container.countItem(item as Item) as int;
myContainer.countItem(myItem);

Parameters:

Return Type: int

countStack(item as IItemStack) as int
script.zs
// Container.countStack(item as IItemStack) as int;
myContainer.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
// Container.getItem(index as int) as ItemStack;
myContainer.getItem(myInt);

Parameters:

index Type: int - The slot index to get.

Return Type: ItemStack

hasAnyOf(items as Set<Item>) as bool
script.zs
// Container.hasAnyOf(items as Set<Item>) as bool;
myContainer.hasAnyOf(mySet);

Parameters:

items Type: Set<ItemDefinition>

Return Type: bool

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

Return Type: bool

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

Returns: True if empty. False otherwise.

script.zs
// Container.isEmpty() as bool;
myContainer.isEmpty();

Return Type: bool

Getter
script.zs
// Container.maxStackSize as int
myContainer.maxStackSize

Return Type: int

maxStackSize() as int
script.zs
// Container.maxStackSize() as int;
myContainer.maxStackSize();

Return Type: int

removeItem(var1 as int, var2 as int) as ItemStack
script.zs
// Container.removeItem(var1 as int, var2 as int) as ItemStack;
myContainer.removeItem(myInt, myInt);

Parameters:

var1 Type: int
var2 Type: int

Return Type: ItemStack

removeItemNoUpdate(index as int) as ItemStack
script.zs
// Container.removeItemNoUpdate(index as int) as ItemStack;
myContainer.removeItemNoUpdate(myInt);

Parameters:

index Type: int

Return Type: ItemStack

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

Parameters:

index Type: int
stack Type: ItemStack
startOpen(player as Player)
script.zs
// Container.startOpen(player as Player);
myContainer.startOpen(myPlayer);

Parameters:

player Type: Player
stillValid(player as Player) as bool
script.zs
// Container.stillValid(player as Player) as bool;
myContainer.stillValid(myPlayer);

Parameters:

player Type: Player

Return Type: bool

stopOpen(player as Player)
script.zs
// Container.stopOpen(player as Player);
myContainer.stopOpen(myPlayer);

Parameters:

player Type: Player