Home Getting Started With Scripts Commands Examples
BracketDumpers BracketHandlers BracketValidators

Inventory

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.entity.type.player.Inventory;

Implemented Interfaces

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

Methods

Return Type: boolean

script.zs
Inventory.add(stack as ItemStack) as boolean
ParameterTypeDescription
Parameter
stack
Type
ItemStack
Description
No Description Provided

Return Type: boolean

script.zs
Inventory.add(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: boolean

script.zs
Inventory.contains(stack as ItemStack) as boolean
ParameterTypeDescription
Parameter
stack
Type
ItemStack
Description
No Description Provided

Return Type: boolean

script.zs
Inventory.contains(tag as MCTag<ItemDefinition>) as boolean
ParameterTypeDescription
Parameter
tag
Type
MCTag<ItemDefinition>
Description
No Description Provided

Return Type: void

script.zs
// Inventory.dropAll() as void
myInventory.dropAll();

Return Type: int

script.zs
Inventory.findSlotMatchingItem(stack as ItemStack) as int
ParameterTypeDescription
Parameter
stack
Type
ItemStack
Description
No Description Provided

Return Type: int

script.zs
Inventory.findSlotMatchingUnusedItem(stack as ItemStack) as int
ParameterTypeDescription
Parameter
stack
Type
ItemStack
Description
No Description Provided

Return Type: ItemStack

script.zs
Inventory.getArmor(armorIndex as int) as ItemStack
ParameterTypeDescription
Parameter
armorIndex
Type
int
Description
No Description Provided

Return Type: int

script.zs
// Inventory.getFreeSlot() as int
myInventory.getFreeSlot();

Return Type: ItemStack

script.zs
// Inventory.getSelected() as ItemStack
myInventory.getSelected();

Return Type: int

script.zs
Inventory.getSlotWithRemainingSpace(stack as ItemStack) as int
ParameterTypeDescription
Parameter
stack
Type
ItemStack
Description
No Description Provided

Return Type: int

script.zs
// Inventory.getSuitableHotbarSlot() as int
myInventory.getSuitableHotbarSlot();

Return Type: int

script.zs
// Inventory.getTimesChanged() as int
myInventory.getTimesChanged();

Return Type: void

script.zs
Inventory.hurtArmor(source as DamageSource, damage as float, armorSlots as int[]) as void
ParameterTypeDescription
Parameter
source
Type
DamageSource
Description
No Description Provided
Parameter
damage
Type
float
Description
No Description Provided
Parameter
armorSlots
Type
int[]
Description
No Description Provided

Return Type: void

script.zs
Inventory.pickSlot(index as int) as void
ParameterTypeDescription
Parameter
index
Type
int
Description
No Description Provided

Return Type: void

script.zs
Inventory.removeItem(stack as ItemStack) as void
ParameterTypeDescription
Parameter
stack
Type
ItemStack
Description
No Description Provided

Return Type: void

script.zs
Inventory.setPickedItem(stack as ItemStack) as void
ParameterTypeDescription
Parameter
stack
Type
ItemStack
Description
No Description Provided

Properties

NameTypeHas GetterHas SetterDescription
Name
freeSlot
Type
int
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
selected
Type
ItemStack
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
suitableHotbarSlot
Type
int
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
timesChanged
Type
int
Has Getter
true
Has Setter
false
Description
No Description Provided