public class VanillaDoubleChestItemHandler extends java.lang.ref.WeakReference<TileEntityChest> implements IItemHandlerModifiable
| Modifier and Type | Field and Description |
|---|---|
static VanillaDoubleChestItemHandler |
NO_ADJACENT_CHESTS_INSTANCE |
| Constructor and Description |
|---|
VanillaDoubleChestItemHandler(TileEntityChest mainChest,
TileEntityChest other,
boolean mainChestIsUpper) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
ItemStack |
extractItem(int slot,
int amount,
boolean simulate)
Extracts an ItemStack from the given slot.
|
static VanillaDoubleChestItemHandler |
get(TileEntityChest chest) |
TileEntityChest |
getChest(boolean accessingUpper) |
int |
getSlotLimit(int slot)
Retrieves the maximum stack size allowed to exist in the given slot.
|
int |
getSlots()
Returns the number of slots available
|
ItemStack |
getStackInSlot(int slot)
Returns the ItemStack in a given slot.
|
int |
hashCode() |
ItemStack |
insertItem(int slot,
ItemStack stack,
boolean simulate)
Inserts an ItemStack into the given slot and return the remainder.
|
boolean |
isItemValid(int slot,
ItemStack stack)
This function re-implements the vanilla function
IInventory.isItemValidForSlot(int, ItemStack). |
boolean |
needsRefresh() |
void |
setStackInSlot(int slot,
ItemStack stack)
Overrides the stack in the given slot.
|
public static final VanillaDoubleChestItemHandler NO_ADJACENT_CHESTS_INSTANCE
public VanillaDoubleChestItemHandler(TileEntityChest mainChest, TileEntityChest other, boolean mainChestIsUpper)
public static VanillaDoubleChestItemHandler get(TileEntityChest chest)
public TileEntityChest getChest(boolean accessingUpper)
public int getSlots()
IItemHandlergetSlots in interface IItemHandlerpublic ItemStack getStackInSlot(int slot)
IItemHandlerIMPORTANT: This ItemStack MUST NOT be modified. This method is not for altering an inventory's contents. Any implementers who are able to detect modification through this method should throw an exception.
SERIOUSLY: DO NOT MODIFY THE RETURNED ITEMSTACK
getStackInSlot in interface IItemHandlerslot - Slot to querypublic void setStackInSlot(int slot,
ItemStack stack)
IItemHandlerModifiablesetStackInSlot in interface IItemHandlerModifiableslot - Slot to modifystack - ItemStack to set slot to (may be empty).public ItemStack insertItem(int slot, ItemStack stack, boolean simulate)
IItemHandlerInserts an ItemStack into the given slot and return the remainder. The ItemStack should not be modified in this function!
Note: This behaviour is subtly different fromIFluidHandler.fill(FluidStack, boolean)insertItem in interface IItemHandlerslot - Slot to insert into.stack - ItemStack to insert. This must not be modified by the item handler.simulate - If true, the insertion is only simulatedpublic ItemStack extractItem(int slot, int amount, boolean simulate)
IItemHandler
The returned value must be empty if nothing is extracted,
otherwise its stack size must be less than or equal to amount and ItemStack.getMaxStackSize().
extractItem in interface IItemHandlerslot - Slot to extract from.amount - Amount to extract (may be greater than the current stack's max limit)simulate - If true, the extraction is only simulatedpublic int getSlotLimit(int slot)
IItemHandlergetSlotLimit in interface IItemHandlerslot - Slot to query.public boolean isItemValid(int slot,
ItemStack stack)
IItemHandler
This function re-implements the vanilla function IInventory.isItemValidForSlot(int, ItemStack).
It should be used instead of simulated insertions in cases where the contents and state of the inventory are
irrelevant, mainly for the purpose of automation and logic (for instance, testing if a minecart can wait
to deposit its items into a full inventory, or if the items in the minecart can never be placed into the
inventory and should move on).
isItemValid in interface IItemHandlerslot - Slot to query for validitystack - Stack to test with for validitypublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean needsRefresh()