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.
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
Container.canPlaceItem(index as int, stack as ItemStack) as boolean| Parameter | Type | 
|---|---|
| Parameterindex | Typeint | 
| Parameterstack | TypeItemStack | 
Return Type: int
Container.countItem(item as ItemDefinition) as int| Parameter | Type | 
|---|---|
| Parameteritem | TypeItemDefinition | 
Return Type: int
Container.countStack(item as IItemStack) as int| Parameter | Type | 
|---|---|
| Parameteritem | TypeIItemStack | 
Gets the size (how many slots) of this Container
Returns: The amount of slots this Container has.
Return Type: int
// Container.getContainerSize() as int
myContainer.getContainerSize();Gets the ItemStack in the given slot.
Returns: the ItemStack in the given slot.
Return Type: ItemStack
Container.getItem(index as int) as ItemStack| Parameter | Type | Description | 
|---|---|---|
| Parameterindex | Typeint | DescriptionThe slot index to get. | 
Return Type: int
// Container.getMaxStackSize() as int
myContainer.getMaxStackSize();Return Type: boolean
Container.hasAnyOf(items as Set<ItemDefinition>) as boolean| Parameter | Type | 
|---|---|
| Parameteritems | TypeSet<ItemDefinition> | 
Checks if this Container is empty.
Returns: True if empty. False otherwise.
Return Type: boolean
// Container.isEmpty() as boolean
myContainer.isEmpty();Return Type: ItemStack
Container.removeItem(var1 as int, var2 as int) as ItemStack| Parameter | Type | 
|---|---|
| Parametervar1 | Typeint | 
| Parametervar2 | Typeint | 
Return Type: ItemStack
Container.removeItemNoUpdate(index as int) as ItemStack| Parameter | Type | 
|---|---|
| Parameterindex | Typeint | 
// Container.setChanged()
myContainer.setChanged();Container.setItem(index as int, stack as ItemStack)| Parameter | Type | 
|---|---|
| Parameterindex | Typeint | 
| Parameterstack | TypeItemStack | 
Container.startOpen(player as Player)| Parameter | Type | 
|---|---|
| Parameterplayer | TypePlayer | 
Return Type: boolean
Container.stillValid(player as Player) as boolean| Parameter | Type | 
|---|---|
| Parameterplayer | TypePlayer | 
Container.stopOpen(player as Player)| Parameter | Type | 
|---|---|
| Parameterplayer | TypePlayer | 
Properties
| Name | Type | Has Getter | Has Setter | Description | 
|---|---|---|---|---|
| Namechanged | Typevoid | Has Gettertrue | Has Setterfalse | Description | 
| NamecontainerSize | Typeint | Has Gettertrue | Has Setterfalse | DescriptionGets the size (how many slots) of this Container | 
| NameisEmpty | Typeboolean | Has Gettertrue | Has Setterfalse | DescriptionChecks if this Container is empty. | 
| NamemaxStackSize | Typeint | Has Gettertrue | Has Setterfalse | Description |