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.
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
Inventory.add(stack as ItemStack) as boolean| Parameter | Type | Description |
|---|---|---|
Parameter stack | Type ItemStack | Description No Description Provided |
Return Type: boolean
Inventory.add(index as int, stack as ItemStack) as boolean| Parameter | Type | Description |
|---|---|---|
Parameter index | Type int | Description No Description Provided |
Parameter stack | Type ItemStack | Description No Description Provided |
Return Type: boolean
Inventory.contains(stack as ItemStack) as boolean| Parameter | Type | Description |
|---|---|---|
Parameter stack | Type ItemStack | Description No Description Provided |
Return Type: boolean
Inventory.contains(tag as MCTag<ItemDefinition>) as boolean| Parameter | Type | Description |
|---|---|---|
Parameter tag | Type MCTag<ItemDefinition> | Description No Description Provided |
Return Type: void
// Inventory.dropAll() as void
myInventory.dropAll();Return Type: int
Inventory.findSlotMatchingItem(stack as ItemStack) as int| Parameter | Type | Description |
|---|---|---|
Parameter stack | Type ItemStack | Description No Description Provided |
Return Type: int
Inventory.findSlotMatchingUnusedItem(stack as ItemStack) as int| Parameter | Type | Description |
|---|---|---|
Parameter stack | Type ItemStack | Description No Description Provided |
Return Type: ItemStack
Inventory.getArmor(armorIndex as int) as ItemStack| Parameter | Type | Description |
|---|---|---|
Parameter armorIndex | Type int | Description No Description Provided |
Return Type: int
// Inventory.getFreeSlot() as int
myInventory.getFreeSlot();Return Type: ItemStack
// Inventory.getSelected() as ItemStack
myInventory.getSelected();Return Type: int
Inventory.getSlotWithRemainingSpace(stack as ItemStack) as int| Parameter | Type | Description |
|---|---|---|
Parameter stack | Type ItemStack | Description No Description Provided |
Return Type: int
// Inventory.getSuitableHotbarSlot() as int
myInventory.getSuitableHotbarSlot();Return Type: int
// Inventory.getTimesChanged() as int
myInventory.getTimesChanged();Return Type: void
Inventory.hurtArmor(source as DamageSource, damage as float, armorSlots as int[]) as void| Parameter | Type | Description |
|---|---|---|
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
Inventory.pickSlot(index as int) as void| Parameter | Type | Description |
|---|---|---|
Parameter index | Type int | Description No Description Provided |
Return Type: void
Inventory.removeItem(stack as ItemStack) as void| Parameter | Type | Description |
|---|---|---|
Parameter stack | Type ItemStack | Description No Description Provided |
Return Type: void
Inventory.setPickedItem(stack as ItemStack) as void| Parameter | Type | Description |
|---|---|---|
Parameter stack | Type ItemStack | Description No Description Provided |
Properties
| Name | Type | Has Getter | Has Setter | Description |
|---|---|---|---|---|
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 |