IItemHandler
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.
Methods
Extract from the given slot.
Returns: The stack extracted from the slot.
Return Type: IItemStack
Parameter | Type | Description |
---|---|---|
Parameter slot | Type int | Description The slot to extract from. |
Parameter amount | Type int | Description How much to extract from the slot. |
Parameter simulate | Type boolean | Description If the extraction should actually happen, if true, no changes will be made. |
Gets how much of a stack can fit into the given slot.
Returns: The max stack size of the given stack.
Return Type: int
Parameter | Type | Description |
---|---|---|
Parameter slot | Type int | Description The slot to check. |
Gets the amount of slots in the handler.
Returns: The amount of slots in the handler.
Return Type: int
Gets the stack in the given slot.
Returns: The stack in the slot.
Return Type: IItemStack
Parameter | Type | Description |
---|---|---|
Parameter slot | Type int | Description The slot to get the stack of. |
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
Parameter | Type | Description |
---|---|---|
Parameter slot | Type int | Description The slot to insert into. |
Parameter stack | Type IItemStack | Description The stack to insert. |
Parameter simulate | Type boolean | Description If the insert should actually happen, if true, will be made. |
Checks if the given stack is valid for the given slot.
Returns: true if the stack is valid, false otherwise.
Return Type: boolean
Parameter | Type | Description |
---|---|---|
Parameter slot | Type int | Description The slot to check. |
Parameter stack | Type IItemStack | Description The stack to check. |
Properties
Name | Type | Has Getter | Has Setter | Description |
---|---|---|---|---|
Name slots | Type int | Has Getter true | Has Setter false | Description Gets the amount of slots in the handler. |