net.minecraft.inventory

## Class Slot

- java.lang.Object
- - net.minecraft.inventory.Slot

- Direct Known Subclasses:
    SlotCrafting, SlotFurnace, SlotMerchantResult

      public class Slot
      extends java.lang.Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected IIcon` | `backgroundIcon` Position within background texture file, normally -1 which causes no background to be drawn.
    `IInventory` | `inventory`
    `int` | `slotNumber`
    `protected ResourceLocation` | `texture` Background texture file assigned to this slot, if any.
    `int` | `xDisplayPosition`
    `int` | `yDisplayPosition`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Slot(IInventory par1IInventory, int par2, int par3, int par4)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `canTakeStack(EntityPlayer par1EntityPlayer)`
    `ItemStack` | `decrStackSize(int par1)`
    `boolean` | `func_111238_b()`
    `IIcon` | `getBackgroundIconIndex()`
    `ResourceLocation` | `getBackgroundIconTexture()` Gets the path of the texture file to use for the background image of this slot when drawing the GUI.
    `boolean` | `getHasStack()`
    `int` | `getSlotIndex()` Retrieves the index in the inventory for this slot, this value should typically not be used, but can be useful for some occasions.
    `int` | `getSlotStackLimit()`
    `ItemStack` | `getStack()`
    `boolean` | `isItemValid(ItemStack par1ItemStack)`
    `boolean` | `isSlotInInventory(IInventory par1IInventory, int par2)`
    `protected void` | `onCrafting(ItemStack par1ItemStack)`
    `protected void` | `onCrafting(ItemStack par1ItemStack, int par2)`
    `void` | `onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack)`
    `void` | `onSlotChange(ItemStack par1ItemStack, ItemStack par2ItemStack)`
    `void` | `onSlotChanged()`
    `void` | `putStack(ItemStack par1ItemStack)`
    `void` | `setBackgroundIcon(IIcon icon)` Sets which icon index to use as the background image of the slot when it's empty.
    `void` | `setBackgroundIconTexture(ResourceLocation texture)` Sets the texture file to use for the background image of the slot when it's empty.

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

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

- - ### Field Detail

    - #### inventory

          public final IInventory inventory

    - #### slotNumber

          public int slotNumber

    - #### xDisplayPosition

          public int xDisplayPosition

    - #### yDisplayPosition

          public int yDisplayPosition

    - #### backgroundIcon

          protected IIcon backgroundIcon

      Position within background texture file, normally -1 which causes no background to be drawn.

    - #### texture

          protected ResourceLocation texture

      Background texture file assigned to this slot, if any. Vanilla "/gui/items.png" is used if this is null.

  - ### Constructor Detail

    - #### Slot

          public Slot(IInventory par1IInventory,
              int par2,
              int par3,
              int par4)

  - ### Method Detail

    - #### onSlotChange

          public void onSlotChange(ItemStack par1ItemStack,
                          ItemStack par2ItemStack)

    - #### onCrafting

          protected void onCrafting(ItemStack par1ItemStack,
                        int par2)

    - #### onCrafting

          protected void onCrafting(ItemStack par1ItemStack)

    - #### onPickupFromSlot

          public void onPickupFromSlot(EntityPlayer par1EntityPlayer,
                              ItemStack par2ItemStack)

    - #### isItemValid

          public boolean isItemValid(ItemStack par1ItemStack)

    - #### getStack

          public ItemStack getStack()

    - #### getHasStack

          public boolean getHasStack()

    - #### putStack

          public void putStack(ItemStack par1ItemStack)

    - #### onSlotChanged

          public void onSlotChanged()

    - #### getSlotStackLimit

          public int getSlotStackLimit()

    - #### decrStackSize

          public ItemStack decrStackSize(int par1)

    - #### isSlotInInventory

          public boolean isSlotInInventory(IInventory par1IInventory,
                                  int par2)

    - #### canTakeStack

          public boolean canTakeStack(EntityPlayer par1EntityPlayer)

    - #### getBackgroundIconIndex

          public IIcon getBackgroundIconIndex()

    - #### func_111238_b

          public boolean func_111238_b()

    - #### getBackgroundIconTexture

          public ResourceLocation getBackgroundIconTexture()

      Gets the path of the texture file to use for the background image of this slot when drawing the GUI.
      Returns:
        String: The texture file that will be used in GuiContainer.drawSlotInventory for the slot background.

    - #### setBackgroundIcon

          public void setBackgroundIcon(IIcon icon)

      Sets which icon index to use as the background image of the slot when it's empty.
      Parameters:
        `icon` - The icon to use, null for none

    - #### setBackgroundIconTexture

          public void setBackgroundIconTexture(ResourceLocation texture)

      Sets the texture file to use for the background image of the slot when it's empty.
      Parameters:
        `textureFilename` - String: Path of texture file to use, or null to use "/gui/items.png"

    - #### getSlotIndex

          public int getSlotIndex()

      Retrieves the index in the inventory for this slot, this value should typically not be used, but can be useful for some occasions.
      Returns:
        Index in associated inventory for this slot.