BlockContainerSingleItem

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

Implements

BlockContainerSingleItem implements the following interfaces:

ContainerSingleItem,Container,Clearable

Members

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

Parameters:

index Type: int
stack Type: ItemStack

Return Type: bool

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

Return Type: int

countItem(item as Item) as int
script.zs
// BlockContainerSingleItem.countItem(item as ItemDefinition) as int;
myBlockContainerSingleItem.countItem(myItem);

Parameters:

Return Type: int

countStack(item as IItemStack) as int
script.zs
// BlockContainerSingleItem.countStack(item as IItemStack) as int;
myBlockContainerSingleItem.countStack(myIItemStack);

Parameters:

item Type: IItemStack

Return Type: int

getContainerBlockEntity() as BlockEntity
Gets the BlockEntity that holds the container.

Returns: The BlockEntity that holds the container.

script.zs
// BlockContainerSingleItem.getContainerBlockEntity() as BlockEntity;
myBlockContainerSingleItem.getContainerBlockEntity();

Return Type: BlockEntity

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

Returns: the ItemStack in the given slot.

script.zs
// BlockContainerSingleItem.getItem(index as int) as ItemStack;
myBlockContainerSingleItem.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
// BlockContainerSingleItem.getTheItem() as ItemStack;
myBlockContainerSingleItem.getTheItem();

Return Type: ItemStack

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

Parameters:

items Type: Set<ItemDefinition>

Return Type: bool

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

Return Type: bool

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

Returns: True if empty. False otherwise.

script.zs
// BlockContainerSingleItem.isEmpty() as bool;
myBlockContainerSingleItem.isEmpty();

Return Type: bool

Getter
script.zs
// BlockContainerSingleItem.maxStackSize as int
myBlockContainerSingleItem.maxStackSize

Return Type: int

maxStackSize() as int
script.zs
// BlockContainerSingleItem.maxStackSize() as int;
myBlockContainerSingleItem.maxStackSize();

Return Type: int

removeItem(var1 as int, var2 as int) as ItemStack
script.zs
// BlockContainerSingleItem.removeItem(var1 as int, var2 as int) as ItemStack;
myBlockContainerSingleItem.removeItem(myInt, myInt);

Parameters:

var1 Type: int
var2 Type: int

Return Type: ItemStack

removeItemNoUpdate(index as int) as ItemStack
script.zs
// BlockContainerSingleItem.removeItemNoUpdate(index as int) as ItemStack;
myBlockContainerSingleItem.removeItemNoUpdate(myInt);

Parameters:

index Type: int

Return Type: ItemStack

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

Parameters:

index Type: int
stack Type: ItemStack
setTheItem(stack as ItemStack)
Sets the only item held by the container.
script.zs
// BlockContainerSingleItem.setTheItem(stack as ItemStack);
myBlockContainerSingleItem.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
// BlockContainerSingleItem.splitTheItem(amount as int) as ItemStack;
myBlockContainerSingleItem.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
// BlockContainerSingleItem.startOpen(player as Player);
myBlockContainerSingleItem.startOpen(myPlayer);

Parameters:

player Type: Player
stillValid(player as Player) as bool
Checks if the player container is still valid for a player to interact with.

Returns: Whether the player can still access the container.

script.zs
// BlockContainerSingleItem.stillValid(player as Player) as bool;
myBlockContainerSingleItem.stillValid(myPlayer);

Parameters:

player Type: Player - The player interacting with the container.

Return Type: bool

stopOpen(player as Player)
script.zs
// BlockContainerSingleItem.stopOpen(player as Player);
myBlockContainerSingleItem.stopOpen(myPlayer);

Parameters:

player Type: Player