IItemHandler
Link to iitemhandler
Importare la Classe
Link to importare-la-classe
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;
Metodi
Link to metodi
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);
Parametro | Tipo | Descrizione |
---|---|---|
Parametro slot | Tipo int | Descrizione The slot to extract from. |
Parametro amount | Tipo int | Descrizione How much to extract from the slot. |
Parametro simulate | Tipo boolean | Descrizione 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);
Parametro | Tipo | Descrizione |
---|---|---|
Parametro slot | Tipo int | Descrizione 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);
Parametro | Tipo | Descrizione |
---|---|---|
Parametro slot | Tipo int | Descrizione 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);
Parametro | Tipo | Descrizione |
---|---|---|
Parametro slot | Tipo int | Descrizione The slot to insert into. |
Parametro stack | Tipo IItemStack | Descrizione The stack to insert. |
Parametro simulate | Tipo boolean | Descrizione 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
Parametro | Tipo | Descrizione |
---|---|---|
Parametro slot | Tipo int | Descrizione The slot to check. |
Parametro stack | Tipo IItemStack | Descrizione The stack to check. |
Proprietà
Link to proprietà
Nome | Tipo | Ha Getter | Ha Setter | Descrizione |
---|---|---|---|---|
Nome slots | Tipo int | Ha Getter sì | Ha Setter no | Descrizione Gets the amount of slots in the handler. |