public class SidedInventoryWrapper
extends java.lang.Object
implements net.minecraftforge.items.IItemHandlerModifiable
Modifier and Type | Field and Description |
---|---|
protected InventorySided |
inv |
protected net.minecraft.util.Direction |
side |
Constructor and Description |
---|
SidedInventoryWrapper(InventorySided inv,
net.minecraft.util.Direction side) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
net.minecraft.item.ItemStack |
extractItem(int slot,
int amount,
boolean simulate) |
static int |
getSlot(InventorySided inv,
int slot,
net.minecraft.util.Direction side) |
int |
getSlotLimit(int slot)
Retrieves the maximum stack size allowed to exist in the given slot.
|
int |
getSlots() |
net.minecraft.item.ItemStack |
getStackInSlot(int slot) |
int |
hashCode() |
net.minecraft.item.ItemStack |
insertItem(int slot,
net.minecraft.item.ItemStack stack,
boolean simulate) |
boolean |
isItemValid(int slot,
net.minecraft.item.ItemStack stack)
This function re-implements the vanilla function IInventory#isItemValidForSlot(int, ItemStack).
|
void |
setStackInSlot(int slot,
net.minecraft.item.ItemStack stack) |
protected final InventorySided inv
protected final net.minecraft.util.Direction side
public SidedInventoryWrapper(InventorySided inv, net.minecraft.util.Direction side)
public static int getSlot(InventorySided inv, int slot, net.minecraft.util.Direction side)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int getSlots()
getSlots
in interface net.minecraftforge.items.IItemHandler
public net.minecraft.item.ItemStack getStackInSlot(int slot)
getStackInSlot
in interface net.minecraftforge.items.IItemHandler
public net.minecraft.item.ItemStack insertItem(int slot, net.minecraft.item.ItemStack stack, boolean simulate)
insertItem
in interface net.minecraftforge.items.IItemHandler
public void setStackInSlot(int slot, net.minecraft.item.ItemStack stack)
setStackInSlot
in interface net.minecraftforge.items.IItemHandlerModifiable
public net.minecraft.item.ItemStack extractItem(int slot, int amount, boolean simulate)
extractItem
in interface net.minecraftforge.items.IItemHandler
public int getSlotLimit(int slot)
getSlotLimit
in interface net.minecraftforge.items.IItemHandler
slot
- Slot to query.public boolean isItemValid(int slot, @Nonnull net.minecraft.item.ItemStack stack)
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 net.minecraftforge.items.IItemHandler
slot
- Slot to query for validitystack
- Stack to test with for validity