Importare la Classe

Link to importare-la-classe

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
Copy
import crafttweaker.api.world.Container;

Interfacce Implementate

Link to interfacce-implementate

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

Name: canPlaceItem

Return Type: boolean

ZenScript
Copy
Container.canPlaceItem(index as int, stack as ItemStack) as boolean
ParametroTipo
Parametro
indice
Tipo
int
Parametro
stack
Tipo
ItemStack

Name: countItem

Return Type: int

ZenScript
Copy
Container.countItem(item as ItemDefinition) as int
ParametroTipo
Parametro
item
Tipo
ItemDefinition

Name: countStack

Return Type: int

ZenScript
Copy
Container.countStack(item as IItemStack) as int
ParametroTipo
Parametro
item
Tipo
IItemStack

Link to getContainerSize

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
Copy
Container.getItem(index as int) as ItemStack
ParametroTipoDescrizione
Parametro
indice
Tipo
int
Descrizione
The slot index to get.

Name: getMaxStackSize

Return Type: int

ZenScript
Copy
// Container.getMaxStackSize() as int

myContainer.getMaxStackSize();

Name: hasAnyOf

Return Type: boolean

ZenScript
Copy
Container.hasAnyOf(items as Set<ItemDefinition>) as boolean
ParametroTipo
Parametro
items
Tipo
Set<ItemDefinition>

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
Copy
Container.removeItem(var1 as int, var2 as int) as ItemStack
ParametroTipo
Parametro
var1
Tipo
int
Parametro
var2
Tipo
int

Link to removeItemNoUpdate

Name: removeItemNoUpdate

Return Type: ItemStack

ZenScript
Copy
Container.removeItemNoUpdate(index as int) as ItemStack
ParametroTipo
Parametro
indice
Tipo
int

Name: setChanged

ZenScript
Copy
// Container.setChanged()

myContainer.setChanged();

Name: setItem

ZenScript
Copy
Container.setItem(index as int, stack as ItemStack)
ParametroTipo
Parametro
indice
Tipo
int
Parametro
stack
Tipo
ItemStack

Name: startOpen

ZenScript
Copy
Container.startOpen(player as Player)
ParametroTipo
Parametro
player
Tipo
Player

Name: stillValid

Return Type: boolean

ZenScript
Copy
Container.stillValid(player as Player) as boolean
ParametroTipo
Parametro
player
Tipo
Player

Name: stopOpen

ZenScript
Copy
Container.stopOpen(player as Player)
ParametroTipo
Parametro
player
Tipo
Player
NomeTipoHa GetterHa SetterDescrizione
Nome
changed
Tipo
void
Ha Getter
Ha Setter
no
Descrizione
Nome
containerSize
Tipo
int
Ha Getter
Ha Setter
no
Descrizione
Gets the size (how many slots) of this Container
Nome
isEmpty
Tipo
boolean
Ha Getter
Ha Setter
no
Descrizione
Checks if this Container is empty.
Nome
maxStackSize
Tipo
int
Ha Getter
Ha Setter
no
Descrizione