Home Getting Started With Scripts Commands Examples
BracketDumpers BracketHandlers BracketValidators

Container

Importing the class

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.

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

Implemented Interfaces

Container implements the following interfaces. That means all methods defined in these interfaces are also available in Container

Methods

Return Type: boolean

script.zs
Container.canPlaceItem(index as int, stack as ItemStack) as boolean
ParameterTypeDescription
Parameter
index
Type
int
Description
No Description Provided
Parameter
stack
Type
ItemStack
Description
No Description Provided

Return Type: int

script.zs
Container.countItem(item as ItemDefinition) as int
ParameterTypeDescription
Parameter
item
Type
ItemDefinition
Description
No Description Provided

Return Type: int

script.zs
Container.countStack(item as IItemStack) as int
ParameterTypeDescription
Parameter
item
Type
IItemStack
Description
No Description Provided

Gets the size (how many slots) of this Container

Returns: The amount of slots this Container has.
Return Type: int

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

Gets the ItemStack in the given slot.

Returns: the ItemStack in the given slot.
Return Type: ItemStack

script.zs
Container.getItem(index as int) as ItemStack
ParameterTypeDescription
Parameter
index
Type
int
Description
The slot index to get.

Return Type: int

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

Return Type: boolean

script.zs
Container.hasAnyOf(items as Set<ItemDefinition>) as boolean
ParameterTypeDescription
Parameter
items
Type
Set<ItemDefinition>
Description
No Description Provided

Checks if this Container is empty.

Returns: True if empty. False otherwise.
Return Type: boolean

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

Return Type: ItemStack

script.zs
Container.removeItem(var1 as int, var2 as int) as ItemStack
ParameterTypeDescription
Parameter
var1
Type
int
Description
No Description Provided
Parameter
var2
Type
int
Description
No Description Provided

Return Type: ItemStack

script.zs
Container.removeItemNoUpdate(index as int) as ItemStack
ParameterTypeDescription
Parameter
index
Type
int
Description
No Description Provided

Return Type: void

script.zs
// Container.setChanged() as void
myContainer.setChanged();

Return Type: void

script.zs
Container.setItem(index as int, stack as ItemStack) as void
ParameterTypeDescription
Parameter
index
Type
int
Description
No Description Provided
Parameter
stack
Type
ItemStack
Description
No Description Provided

Return Type: void

script.zs
Container.startOpen(player as Player) as void
ParameterTypeDescription
Parameter
player
Type
Player
Description
No Description Provided

Return Type: boolean

script.zs
Container.stillValid(player as Player) as boolean
ParameterTypeDescription
Parameter
player
Type
Player
Description
No Description Provided

Return Type: void

script.zs
Container.stopOpen(player as Player) as void
ParameterTypeDescription
Parameter
player
Type
Player
Description
No Description Provided

Properties

NameTypeHas GetterHas SetterDescription
Name
changed
Type
void
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
containerSize
Type
int
Has Getter
true
Has Setter
false
Description
Gets the size (how many slots) of this Container
Name
isEmpty
Type
boolean
Has Getter
true
Has Setter
false
Description
Checks if this Container is empty.
Name
maxStackSize
Type
int
Has Getter
true
Has Setter
false
Description
No Description Provided