Импорт класса

Link to импорт-класса

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

Implemented Interfaces

Link to implemented-interfaces

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

Name: add

Return Type: boolean

ZenScript
Copy
Inventory.add(stack as ItemStack) as boolean
ПараметрТип
Параметр
stack
Тип
ItemStack

Name: add

Return Type: boolean

ZenScript
Copy
Inventory.add(index as int, stack as ItemStack) as boolean
ПараметрТип
Параметр
index
Тип
int
Параметр
stack
Тип
ItemStack

Name: contains

Return Type: boolean

ZenScript
Copy
Inventory.contains(stack as ItemStack) as boolean
ПараметрТип
Параметр
stack
Тип
ItemStack

Name: contains

Return Type: boolean

ZenScript
Copy
Inventory.contains(tag as KnownTag<ItemDefinition>) as boolean
ПараметрТип
Параметр
tag
Тип
KnownTag<ItemDefinition>

Name: dropAll

ZenScript
Copy
// Inventory.dropAll()

myInventory.dropAll();

Link to findSlotMatchingItem

Name: findSlotMatchingItem

Return Type: int

ZenScript
Copy
Inventory.findSlotMatchingItem(stack as ItemStack) as int
ПараметрТип
Параметр
stack
Тип
ItemStack

Link to findSlotMatchingUnusedItem

Name: findSlotMatchingUnusedItem

Return Type: int

ZenScript
Copy
Inventory.findSlotMatchingUnusedItem(stack as ItemStack) as int
ПараметрТип
Параметр
stack
Тип
ItemStack

Name: getArmor

Return Type: ItemStack

ZenScript
Copy
Inventory.getArmor(armorIndex as int) as ItemStack
ПараметрТип
Параметр
armorIndex
Тип
int

Name: getFreeSlot

Return Type: int

ZenScript
Copy
// Inventory.getFreeSlot() as int

myInventory.getFreeSlot();

Name: getSelected

Return Type: ItemStack

ZenScript
Copy
// Inventory.getSelected() as ItemStack

myInventory.getSelected();

Link to getSlotWithRemainingSpace

Name: getSlotWithRemainingSpace

Return Type: int

ZenScript
Copy
Inventory.getSlotWithRemainingSpace(stack as ItemStack) as int
ПараметрТип
Параметр
stack
Тип
ItemStack

Link to getSuitableHotbarSlot

Name: getSuitableHotbarSlot

Return Type: int

ZenScript
Copy
// Inventory.getSuitableHotbarSlot() as int

myInventory.getSuitableHotbarSlot();

Name: getTimesChanged

Return Type: int

ZenScript
Copy
// Inventory.getTimesChanged() as int

myInventory.getTimesChanged();

Name: hurtArmor

ZenScript
Copy
Inventory.hurtArmor(source as DamageSource, damage as float, armorSlots as int[])
ПараметрТип
Параметр
источник
Тип
DamageSource
Параметр
damage
Тип
float
Параметр
armorSlots
Тип
int[]

Name: pickSlot

ZenScript
Copy
Inventory.pickSlot(index as int)
ПараметрТип
Параметр
index
Тип
int

Name: removeItem

ZenScript
Copy
Inventory.removeItem(stack as ItemStack)
ПараметрТип
Параметр
stack
Тип
ItemStack

Name: setPickedItem

ZenScript
Copy
Inventory.setPickedItem(stack as ItemStack)
ПараметрТип
Параметр
stack
Тип
ItemStack

Свойства

Link to свойства

НазваниеТипИмеет GetterИмеет Setter
Название
freeSlot
Тип
int
Имеет Getter
true
Имеет Setter
false
Название
selected
Тип
ItemStack
Имеет Getter
true
Имеет Setter
false
Название
suitableHotbarSlot
Тип
int
Имеет Getter
true
Имеет Setter
false
Название
timesChanged
Тип
int
Имеет Getter
true
Имеет Setter
false