net.minecraft.tileentity

## Class TileEntityDispenser

- java.lang.Object
- - net.minecraft.tileentity.TileEntity
  - - net.minecraft.tileentity.TileEntityDispenser

- All Implemented Interfaces:
    IInventory
  Direct Known Subclasses:
    TileEntityDropper

      public class TileEntityDispenser
      extends TileEntity
      implements IInventory

- - ### Field Summary

    - ### Fields inherited from class net.minecraft.tileentity.TileEntity

      `blockMetadata, blockType, INFINITE_EXTENT_AABB, worldObj, xCoord, yCoord, zCoord`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TileEntityDispenser()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `addItem(ItemStack par1ItemStack)` Add item stack in first available inventory slot
    `void` | `closeChest()`
    `ItemStack` | `decrStackSize(int par1, int par2)` 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` | `getRandomStackFromInventory()`
    `int` | `getSizeInventory()` Returns the number of slots in the inventory.
    `ItemStack` | `getStackInSlot(int par1)` Returns the stack in slot i
    `ItemStack` | `getStackInSlotOnClosing(int par1)` 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 par1, ItemStack par2ItemStack)` Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
    `boolean` | `isUseableByPlayer(EntityPlayer par1EntityPlayer)` Do not make give this method the name canInteractWith because it clashes with Container
    `void` | `openChest()`
    `void` | `readFromNBT(NBTTagCompound par1NBTTagCompound)` Reads a tile entity from NBT.
    `void` | `setCustomName(String par1Str)`
    `void` | `setInventorySlotContents(int par1, ItemStack par2ItemStack)` Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
    `void` | `writeToNBT(NBTTagCompound par1NBTTagCompound)` Writes a tile entity to NBT.

    - ### Methods inherited from class net.minecraft.tileentity.TileEntity

      `addMapping, canUpdate, createAndLoadEntity, func_70309_m, func_85027_a, getBlockMetadata, getBlockType, getDescriptionPacket, getDistanceFrom, getMaxRenderDistanceSquared, getRenderBoundingBox, getWorldObj, invalidate, isInvalid, onChunkUnload, onDataPacket, onInventoryChanged, receiveClientEvent, setWorldObj, shouldRefresh, shouldRenderInPass, updateContainingBlockInfo, updateEntity, validate`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface net.minecraft.inventory.IInventory

      `onInventoryChanged`

- - ### Constructor Detail

    - #### TileEntityDispenser

          public TileEntityDispenser()

  - ### Method Detail

    - #### getSizeInventory

          public int getSizeInventory()

      Returns the number of slots in the inventory.
      Specified by:
        `getSizeInventory` in interface `IInventory`

    - #### getStackInSlot

          public ItemStack getStackInSlot(int par1)

      Returns the stack in slot i
      Specified by:
        `getStackInSlot` in interface `IInventory`

    - #### decrStackSize

          public ItemStack decrStackSize(int par1,
                                int par2)

      Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a new stack.
      Specified by:
        `decrStackSize` in interface `IInventory`

    - #### getStackInSlotOnClosing

          public ItemStack getStackInSlotOnClosing(int par1)

      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.
      Specified by:
        `getStackInSlotOnClosing` in interface `IInventory`

    - #### getRandomStackFromInventory

          public int getRandomStackFromInventory()

    - #### setInventorySlotContents

          public void setInventorySlotContents(int par1,
                                      ItemStack par2ItemStack)

      Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
      Specified by:
        `setInventorySlotContents` in interface `IInventory`

    - #### addItem

          public int addItem(ItemStack par1ItemStack)

      Add item stack in first available inventory slot

    - #### getInvName

          public String getInvName()

      Returns the name of the inventory.
      Specified by:
        `getInvName` in interface `IInventory`

    - #### setCustomName

          public void setCustomName(String par1Str)

    - #### isInvNameLocalized

          public 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.
      Specified by:
        `isInvNameLocalized` in interface `IInventory`

    - #### readFromNBT

          public void readFromNBT(NBTTagCompound par1NBTTagCompound)

      Reads a tile entity from NBT.
      Overrides:
        `readFromNBT` in class `TileEntity`

    - #### writeToNBT

          public void writeToNBT(NBTTagCompound par1NBTTagCompound)

      Writes a tile entity to NBT.
      Overrides:
        `writeToNBT` in class `TileEntity`

    - #### getInventoryStackLimit

          public 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?*
      Specified by:
        `getInventoryStackLimit` in interface `IInventory`

    - #### isUseableByPlayer

          public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer)

      Do not make give this method the name canInteractWith because it clashes with Container
      Specified by:
        `isUseableByPlayer` in interface `IInventory`

    - #### openChest

          public void openChest()

      Specified by:
        `openChest` in interface `IInventory`

    - #### closeChest

          public void closeChest()

      Specified by:
        `closeChest` in interface `IInventory`

    - #### isStackValidForSlot

          public boolean isStackValidForSlot(int par1,
                                    ItemStack par2ItemStack)

      Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
      Specified by:
        `isStackValidForSlot` in interface `IInventory`