public abstract class Container
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
NonNullList<ItemStack> |
inventoryItemStacks
the list of all items(stacks) for the corresponding slot
|
java.util.List<Slot> |
inventorySlots
the list of all slots in the inventory
|
protected java.util.List<IContainerListener> |
listeners
list of all people that need to be notified when this craftinventory changes
|
int |
windowId |
Constructor and Description |
---|
Container() |
Modifier and Type | Method and Description |
---|---|
void |
addListener(IContainerListener listener) |
protected Slot |
addSlotToContainer(Slot slotIn)
Adds an item slot to this container
|
static int |
calcRedstone(TileEntity te)
Like the version that takes an inventory.
|
static int |
calcRedstoneFromInventory(IInventory inv) |
static boolean |
canAddItemToSlot(Slot slotIn,
ItemStack stack,
boolean stackSizeMatters)
Checks if it's possible to add the given itemstack to the given slot.
|
boolean |
canDragIntoSlot(Slot slotIn)
Returns true if the player can "drag-spilt" items into this slot,.
|
abstract boolean |
canInteractWith(EntityPlayer playerIn)
Determines whether supplied player can use this container
|
boolean |
canMergeSlot(ItemStack stack,
Slot slotIn)
Called to determine if the current slot is valid for the stack merging (double-click) code.
|
static void |
computeStackSize(java.util.Set<Slot> dragSlotsIn,
int dragModeIn,
ItemStack stack,
int slotStackSize)
Compute the new stack size, Returns the stack with the new size.
|
void |
detectAndSendChanges()
Looks for changes made in the container, sends them to every listener.
|
boolean |
enchantItem(EntityPlayer playerIn,
int id)
Handles the given Button-click on the server, currently only used by enchanting.
|
static int |
extractDragMode(int eventButton)
Extracts the drag mode.
|
boolean |
getCanCraft(EntityPlayer player)
gets whether or not the player can craft in this inventory or not
|
static int |
getDragEvent(int clickedButton)
Args : clickedButton, Returns (0 : start drag, 1 : add slot, 2 : end drag)
|
NonNullList<ItemStack> |
getInventory()
returns a list if itemStacks, for each slot.
|
short |
getNextTransactionID(InventoryPlayer invPlayer)
Gets a unique transaction ID.
|
static int |
getQuickcraftMask(int p_94534_0_,
int p_94534_1_) |
Slot |
getSlot(int slotId) |
Slot |
getSlotFromInventory(IInventory inv,
int slotIn) |
static boolean |
isValidDragMode(int dragModeIn,
EntityPlayer player) |
protected boolean |
mergeItemStack(ItemStack stack,
int startIndex,
int endIndex,
boolean reverseDirection)
Merges provided ItemStack with the first avaliable one in the container/player inventor between minIndex
(included) and maxIndex (excluded).
|
void |
onContainerClosed(EntityPlayer playerIn)
Called when the container is closed.
|
void |
onCraftMatrixChanged(IInventory inventoryIn)
Callback for when the crafting matrix is changed.
|
void |
putStackInSlot(int slotID,
ItemStack stack)
Puts an ItemStack in a slot.
|
void |
removeListener(IContainerListener listener)
Remove the given Listener.
|
protected void |
resetDrag()
Reset the drag fields
|
protected void |
retrySlotClick(int slotId,
int clickedButton,
boolean mode,
EntityPlayer playerIn)
Retries slotClick() in case of failure
|
void |
setAll(java.util.List<ItemStack> p_190896_1_) |
void |
setCanCraft(EntityPlayer player,
boolean canCraft)
sets whether the player can craft in this inventory or not
|
ItemStack |
slotClick(int slotId,
int dragType,
ClickType clickTypeIn,
EntityPlayer player) |
ItemStack |
transferStackInSlot(EntityPlayer playerIn,
int index)
Take a stack from the specified inventory slot.
|
void |
updateProgressBar(int id,
int data) |
public NonNullList<ItemStack> inventoryItemStacks
public java.util.List<Slot> inventorySlots
public int windowId
protected java.util.List<IContainerListener> listeners
protected Slot addSlotToContainer(Slot slotIn)
public void addListener(IContainerListener listener)
public NonNullList<ItemStack> getInventory()
public void removeListener(IContainerListener listener)
public void detectAndSendChanges()
public boolean enchantItem(EntityPlayer playerIn, int id)
public Slot getSlotFromInventory(IInventory inv, int slotIn)
public Slot getSlot(int slotId)
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player)
public boolean canMergeSlot(ItemStack stack, Slot slotIn)
protected void retrySlotClick(int slotId, int clickedButton, boolean mode, EntityPlayer playerIn)
public void onContainerClosed(EntityPlayer playerIn)
public void onCraftMatrixChanged(IInventory inventoryIn)
public void putStackInSlot(int slotID, ItemStack stack)
public void setAll(java.util.List<ItemStack> p_190896_1_)
public void updateProgressBar(int id, int data)
public short getNextTransactionID(InventoryPlayer invPlayer)
public boolean getCanCraft(EntityPlayer player)
public void setCanCraft(EntityPlayer player, boolean canCraft)
public abstract boolean canInteractWith(EntityPlayer playerIn)
protected boolean mergeItemStack(ItemStack stack, int startIndex, int endIndex, boolean reverseDirection)
public static int extractDragMode(int eventButton)
public static int getDragEvent(int clickedButton)
public static int getQuickcraftMask(int p_94534_0_, int p_94534_1_)
public static boolean isValidDragMode(int dragModeIn, EntityPlayer player)
protected void resetDrag()
public static boolean canAddItemToSlot(Slot slotIn, ItemStack stack, boolean stackSizeMatters)
public static void computeStackSize(java.util.Set<Slot> dragSlotsIn, int dragModeIn, ItemStack stack, int slotStackSize)
public boolean canDragIntoSlot(Slot slotIn)
public static int calcRedstone(TileEntity te)
public static int calcRedstoneFromInventory(IInventory inv)