IItemHandler
Link to iitemhandler
Импорт класса
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 Copyimport crafttweaker.api.capability.IItemHandler;
Методы
Link to методы
Name: extractItem
Extract from the given slot.
Returns: The stack extracted from the slot.
Return Type: IItemStack
ZenScript Copy// IItemHandler.extractItem(slot as int, amount as int, simulate as boolean) as IItemStack
myIItemHandler.extractItem(0, 5, false);
Параметр | Тип | Описание |
---|---|---|
Параметр slot | Тип int | Описание The slot to extract from. |
Параметр amount | Тип int | Описание How much to extract from the slot. |
Параметр simulate | Тип boolean | Описание If the extraction should actually happen, if true, no changes will be made. |
Name: getSlotLimit
Gets how much of a stack can fit into the given slot.
Returns: The max stack size of the given stack.
Return Type: int
ZenScript Copy// IItemHandler.getSlotLimit(slot as int) as int
myIItemHandler.getSlotLimit(1);
Параметр | Тип | Описание |
---|---|---|
Параметр slot | Тип int | Описание The slot to check. |
Name: getSlots
Gets the amount of slots in the handler.
Returns: The amount of slots in the handler.
Return Type: int
ZenScript Copy// IItemHandler.getSlots() as int
myIItemHandler.getSlots();
Name: getStackInSlot
Gets the stack in the given slot.
Returns: The stack in the slot.
Return Type: IItemStack
ZenScript Copy// IItemHandler.getStackInSlot(slot as int) as IItemStack
myIItemHandler.getStackInSlot(1);
Параметр | Тип | Описание |
---|---|---|
Параметр slot | Тип int | Описание The slot to get the stack of. |
Name: insertItem
Inserts the stack into the given slot and returns the remainder.
The remainder returned is how much was not inserted.
For example if slot 0
had 63
dirt, and you tried to insert 5
dirt, you will get a remainder of 4
dirt.
Returns: The remaining stack that was not inserted.
Return Type: IItemStack
ZenScript Copy// IItemHandler.insertItem(slot as int, stack as IItemStack, simulate as boolean) as IItemStack
myIItemHandler.insertItem(1, <item:minecraft:dirt>, true);
Параметр | Тип | Описание |
---|---|---|
Параметр slot | Тип int | Описание The slot to insert into. |
Параметр stack | Тип IItemStack | Описание The stack to insert. |
Параметр simulate | Тип boolean | Описание If the insert should actually happen, if true, will be made. |
Name: isItemValid
Checks if the given stack is valid for the given slot.
Returns: true if the stack is valid, false otherwise.
Return Type: boolean
ZenScript CopyIItemHandler.isItemValid(slot as int, stack as IItemStack) as boolean
Параметр | Тип | Описание |
---|---|---|
Параметр slot | Тип int | Описание The slot to check. |
Параметр stack | Тип IItemStack | Описание The stack to check. |
Свойства
Link to свойства
Название | Тип | Имеет Getter | Имеет Setter | Описание |
---|---|---|---|---|
Название slots | Тип int | Имеет Getter true | Имеет Setter false | Описание Gets the amount of slots in the handler. |