net.minecraft.inventory

## Interface IInventory

- All Known Subinterfaces:
    Hopper, ISidedInventory, ISidedInventory
  All Known Implementing Classes:
    EntityMinecartChest, EntityMinecartContainer, EntityMinecartHopper, InventoryBasic, InventoryCrafting, InventoryCraftResult, InventoryEnderChest, InventoryLargeChest, InventoryMerchant, InventoryPlayer, TileEntityBeacon, TileEntityBrewingStand, TileEntityChest, TileEntityDispenser, TileEntityDropper, TileEntityFurnace, TileEntityHopper

      public interface IInventory

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `closeChest()`
    `ItemStack` | `decrStackSize(int i, int j)` Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a new stack.
    `int` | `getInventoryStackLimit()` Returns the maximum stack size for a inventory slot.
    `String` | `getInvName()` Returns the name of the inventory.
    `int` | `getSizeInventory()` Returns the number of slots in the inventory.
    `ItemStack` | `getStackInSlot(int i)` Returns the stack in slot i
    `ItemStack` | `getStackInSlotOnClosing(int i)` When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - like when you close a workbench GUI.
    `boolean` | `isInvNameLocalized()` If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's language.
    `boolean` | `isStackValidForSlot(int i, ItemStack itemstack)` Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
    `boolean` | `isUseableByPlayer(EntityPlayer entityplayer)` Do not make give this method the name canInteractWith because it clashes with Container
    `void` | `onInventoryChanged()` Called when an the contents of an Inventory change, usually
    `void` | `openChest()`
    `void` | `setInventorySlotContents(int i, ItemStack itemstack)` Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).

- - ### Method Detail

    - #### getSizeInventory

          int getSizeInventory()

      Returns the number of slots in the inventory.

    - #### getStackInSlot

          ItemStack getStackInSlot(int i)

      Returns the stack in slot i

    - #### decrStackSize

          ItemStack decrStackSize(int i,
                                int j)

      Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a new stack.

    - #### getStackInSlotOnClosing

          ItemStack getStackInSlotOnClosing(int i)

      When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - like when you close a workbench GUI.

    - #### setInventorySlotContents

          void setInventorySlotContents(int i,
                                      ItemStack itemstack)

      Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).

    - #### getInvName

          String getInvName()

      Returns the name of the inventory.

    - #### isInvNameLocalized

          boolean isInvNameLocalized()

      If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's language. Otherwise it will be used directly.

    - #### getInventoryStackLimit

          int getInventoryStackLimit()

      Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't this more of a set than a get?*

    - #### onInventoryChanged

          void onInventoryChanged()

      Called when an the contents of an Inventory change, usually

    - #### isUseableByPlayer

          boolean isUseableByPlayer(EntityPlayer entityplayer)

      Do not make give this method the name canInteractWith because it clashes with Container

    - #### openChest

          void openChest()

    - #### closeChest

          void closeChest()

    - #### isStackValidForSlot

          boolean isStackValidForSlot(int i,
                                    ItemStack itemstack)

      Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.