Class Container

    • Field Detail

      • inventoryItemStacks

        public java.util.List<ItemStack> inventoryItemStacks
        + the list of all items(stacks) for the corresponding slot
      • inventorySlots

        public java.util.List<Slot> inventorySlots
        + the list of all slots in the inventory
      • windowId

        public int windowId
      • crafters

        protected java.util.List<ICrafting> crafters
        + list of all people that need to be notified when this craftinventory changes
    • Constructor Detail

      • Container

        public Container()
    • Method Detail

      • loadPluginData

        public void loadPluginData​(BaseData data)
      • makePluginData

        public PluginData makePluginData()
      • addSlotToContainer

        protected Slot addSlotToContainer​(Slot slotIn)
        + Adds an item slot to this container
      • onCraftGuiOpened

        public void onCraftGuiOpened​(ICrafting listener)
      • removeCraftingFromCrafters

        public void removeCraftingFromCrafters​(ICrafting listeners)
        + Remove the given Listener. Method name is for legacy.
      • getInventory

        public java.util.List<ItemStack> getInventory()
        + returns a list if itemStacks, for each slot.
      • detectAndSendChanges

        public void detectAndSendChanges()
        + Looks for changes made in the container, sends them to every listener.
      • enchantItem

        public boolean enchantItem​(EntityPlayer playerIn,
                                   int id)
        + Handles the given Button-click on the server, currently only used by enchanting. Name is for legacy.
      • getSlotFromInventory

        public Slot getSlotFromInventory​(IInventory inv,
                                         int slotIn)
      • getSlot

        public Slot getSlot​(int slotId)
      • transferStackInSlot

        public ItemStack transferStackInSlot​(EntityPlayer var1,
                                             int i)
        + Take a stack from the specified inventory slot.
      • slotClick

        public ItemStack slotClick​(int slotId,
                                   int clickedButton,
                                   int mode,
                                   EntityPlayer playerIn)
        + Handles slot click.
      • canMergeSlot

        public boolean canMergeSlot​(ItemStack var1,
                                    Slot var2)
        + Called to determine if the current slot is valid for the stack merging (double-click) code. The stack passed in is null for the initial slot that was double-clicked.
      • retrySlotClick

        protected void retrySlotClick​(int i,
                                      int j,
                                      boolean var3,
                                      EntityPlayer entityplayer)
        + Retries slotClick() in case of failure
      • onContainerClosed

        public void onContainerClosed​(EntityPlayer playerIn)
        + Called when the container is closed.
      • onCraftMatrixChanged

        public void onCraftMatrixChanged​(IInventory inventoryIn)
        + Callback for when the crafting matrix is changed.
      • putStackInSlot

        public void putStackInSlot​(int slotID,
                                   ItemStack stack)
        + args: slotID, itemStack to put in slot
      • putStacksInSlots

        public void putStacksInSlots​(ItemStack[] parArrayOfItemStack)
        + places itemstacks in first x slots, x being aitemstack.lenght
      • updateProgressBar

        public void updateProgressBar​(int id,
                                      int data)
      • getNextTransactionID

        public short getNextTransactionID​(InventoryPlayer parInventoryPlayer)
        + Gets a unique transaction ID. Parameter is unused.
      • getCanCraft

        public boolean getCanCraft​(EntityPlayer parEntityPlayer)
        + gets whether or not the player can craft in this inventory or not
      • setCanCraft

        public void setCanCraft​(EntityPlayer parEntityPlayer,
                                boolean parFlag)
        + sets whether the player can craft in this inventory or not
      • canInteractWith

        public abstract boolean canInteractWith​(EntityPlayer var1)
      • mergeItemStack

        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). Args : stack, minIndex, maxIndex, negativDirection. /!\ the Container implementation do not check if the item is valid for the slot
      • extractDragMode

        public static int extractDragMode​(int parInt1)
        + Extracts the drag mode. Args : eventButton. Return (0 : evenly split, 1 : one item by slot, 2 : not used ?)
      • getDragEvent

        public static int getDragEvent​(int parInt1)
        + Args : clickedButton, Returns (0 : start drag, 1 : add slot, 2 : end drag)
      • func_94534_d

        public static int func_94534_d​(int parInt1,
                                       int parInt2)
      • isValidDragMode

        public static boolean isValidDragMode​(int dragModeIn,
                                              EntityPlayer player)
      • resetDrag

        protected void resetDrag()
        + Reset the drag fields
      • canAddItemToSlot

        public static boolean canAddItemToSlot​(Slot slotIn,
                                               ItemStack stack,
                                               boolean stackSizeMatters)
        + Checks if it's possible to add the given itemstack to the given slot.
      • computeStackSize

        public static void computeStackSize​(java.util.Set<Slot> parSet,
                                            int parInt1,
                                            ItemStack parItemStack,
                                            int parInt2)
        + Compute the new stack size, Returns the stack with the new size. Args : dragSlots, dragMode, dragStack, slotStackSize
      • canDragIntoSlot

        public boolean canDragIntoSlot​(Slot var1)
        + Returns true if the player can "drag-spilt" items into this slot,. returns true by default. Called to check if the slot can be added to a list of Slots to split the held ItemStack across.
      • calcRedstone

        public static int calcRedstone​(TileEntity te)
        + Like the version that takes an inventory. If the given TileEntity is not an Inventory, 0 is returned instead.
      • calcRedstoneFromInventory

        public static int calcRedstoneFromInventory​(IInventory inv)