Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.minecraft.src
Class ItemStack

    java.lang.Object
      net.minecraft.src.ItemStack

    public final class ItemStack

extends Object

Field Summary
`int` | `animationsToGo` Number of animation frames to go when receiving an item (by walking into it, for example).
`int` | `itemID` ID of the item.
`int` | `stackSize` Size of the stack.
`NBTTagCompound` | `stackTagCompound` A NBTTagMap containing data about an ItemStack.

Constructor Summary
`ItemStack(Block par1Block)`
`ItemStack(Block par1Block, int par2)`
`ItemStack(Block par1Block, int par2, int par3)`
`ItemStack(int par1, int par2, int par3)`
`ItemStack(Item par1Item)`
`ItemStack(Item par1Item, int par2)`
`ItemStack(Item par1Item, int par2, int par3)`

Method Summary
`void` | `addEnchantment(Enchantment par1Enchantment, int par2)` Adds an enchantment with a desired level on the ItemStack.
`static boolean` | `areItemStacksEqual(ItemStack par0ItemStack, ItemStack par1ItemStack)` compares ItemStack argument1 with ItemStack argument2; returns true if both ItemStacks are equal
`boolean` | `canHarvestBlock(Block par1Block)` Checks if the itemStack object can harvest a specified block
`ItemStack` | `copy()` Returns a new stack with the same properties.
`static ItemStack` | `copyItemStack(ItemStack par0ItemStack)` Creates a copy of a ItemStack, a null parameters will return a null.
`void` | `damageItem(int par1, EntityLiving par2EntityLiving)` Damages the item in the ItemStack
`static boolean` | `func_77970_a(ItemStack par0ItemStack, ItemStack par1ItemStack)`
`void` | `func_77983_a(String par1Str, NBTBase par2NBTBase)`
`String` | `func_82833_r()`
`void` | `func_82834_c(String par1Str)`
`boolean` | `func_82835_x()`
`EntityItemFrame` | `func_82836_z()`
`boolean` | `func_82837_s()`
`int` | `func_82838_A()`
`boolean` | `func_82839_y()`
`List` | `func_82840_a(EntityPlayer par1EntityPlayer, boolean par2)`
`void` | `func_82841_c(int par1)`
`void` | `func_82842_a(EntityItemFrame par1EntityItemFrame)`
`int` | `getDamageVsEntity(Entity par1Entity)` Returns the damage against a given entity.
`NBTTagList` | `getEnchantmentTagList()`
`boolean` | `getHasSubtypes()`
`int` | `getIconIndex()`
`Item` | `getItem()` Returns the object corresponding to the stack.
`int` | `getItemDamage()` gets the damage of an itemstack
`int` | `getItemDamageForDisplay()` gets the damage of an itemstack, for displaying purposes
`String` | `getItemName()`
`EnumAction` | `getItemUseAction()`
`int` | `getMaxDamage()` Returns the max damage an item in the stack can take.
`int` | `getMaxItemUseDuration()`
`int` | `getMaxStackSize()` Returns maximum size of the stack.
`EnumRarity` | `getRarity()`
`float` | `getStrVsBlock(Block par1Block)` Returns the strength of the stack against a given block.
`NBTTagCompound` | `getTagCompound()` Returns the NBTTagCompound of the ItemStack.
`boolean` | `hasEffect()`
`boolean` | `hasTagCompound()` Returns true if the ItemStack has an NBTTagCompound.
`void` | `hitEntity(EntityLiving par1EntityLiving, EntityPlayer par2EntityPlayer)` Calls the corresponding fct in di
`boolean` | `interactWith(EntityLiving par1EntityLiving)`
`boolean` | `isItemDamaged()` returns true when a damageable item is damaged
`boolean` | `isItemEnchantable()` True if it is a tool and has no enchantments to begin with
`boolean` | `isItemEnchanted()` True if the item has enchantment data
`boolean` | `isItemEqual(ItemStack par1ItemStack)` compares ItemStack argument to the instance ItemStack; returns true if the Items contained in both ItemStacks are equal
`boolean` | `isItemStackDamageable()` true if this itemStack is damageable
`boolean` | `isStackable()` Returns true if the ItemStack can hold 2 or more units of the item.
`static ItemStack` | `loadItemStackFromNBT(NBTTagCompound par0NBTTagCompound)`
`void` | `onBlockDestroyed(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer)`
`void` | `onCrafting(World par1World, EntityPlayer par2EntityPlayer, int par3)`
`ItemStack` | `onFoodEaten(World par1World, EntityPlayer par2EntityPlayer)`
`void` | `onPlayerStoppedUsing(World par1World, EntityPlayer par2EntityPlayer, int par3)` Called when the player releases the use item button.
`void` | `readFromNBT(NBTTagCompound par1NBTTagCompound)` Read the stack fields from a NBT object.
`void` | `setItemDamage(int par1)` Sets the item damage of the ItemStack.
`void` | `setTagCompound(NBTTagCompound par1NBTTagCompound)` Assigns a NBTTagCompound to the ItemStack, minecraft validates that only non-stackable items can have it.
`ItemStack` | `splitStack(int par1)` Remove the argument from the stack size.
`String` | `toString()`
`boolean` | `tryPlaceItemIntoWorld(EntityPlayer par1EntityPlayer, World par2World, int par3, int par4, int par5, int par6, float par7, float par8, float par9)`
`void` | `updateAnimation(World par1World, Entity par2Entity, int par3, boolean par4)` Called each tick as long the ItemStack in on player inventory.
`ItemStack` | `useItemRightClick(World par1World, EntityPlayer par2EntityPlayer)` Called whenever this item stack is equipped and right clicked.
`NBTTagCompound` | `writeToNBT(NBTTagCompound par1NBTTagCompound)` Write the stack fields to a NBT object.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### stackSize

    public int stackSize

  Size of the stack.

### animationsToGo

    public int animationsToGo

  Number of animation frames to go when receiving an item (by walking into it, for example).

### itemID

    public int itemID

  ID of the item.

### stackTagCompound

    public NBTTagCompound stackTagCompound

  A NBTTagMap containing data about an ItemStack. Can only be used for non stackable items

Constructor Detail

### ItemStack

    public ItemStack(Block par1Block)

### ItemStack

    public ItemStack(Block par1Block,
                     int par2)

### ItemStack

    public ItemStack(Block par1Block,
                     int par2,
                     int par3)

### ItemStack

    public ItemStack(Item par1Item)

### ItemStack

    public ItemStack(Item par1Item,
                     int par2)

### ItemStack

    public ItemStack(Item par1Item,
                     int par2,
                     int par3)

### ItemStack

    public ItemStack(int par1,
                     int par2,
                     int par3)

Method Detail

### loadItemStackFromNBT

    public static ItemStack loadItemStackFromNBT(NBTTagCompound par0NBTTagCompound)

### splitStack

    public ItemStack splitStack(int par1)

  Remove the argument from the stack size. Return a new stack object with argument size.

### getItem

    public Item getItem()

  Returns the object corresponding to the stack.

### getIconIndex

    public int getIconIndex()

### tryPlaceItemIntoWorld

    public boolean tryPlaceItemIntoWorld(EntityPlayer par1EntityPlayer,
                                         World par2World,
                                         int par3,
                                         int par4,
                                         int par5,
                                         int par6,
                                         float par7,
                                         float par8,
                                         float par9)

### getStrVsBlock

    public float getStrVsBlock(Block par1Block)

  Returns the strength of the stack against a given block.

### useItemRightClick

    public ItemStack useItemRightClick(World par1World,
                                       EntityPlayer par2EntityPlayer)

  Called whenever this item stack is equipped and right clicked. Returns the new item stack to put in the position where this item is. Args: world, player

### onFoodEaten

    public ItemStack onFoodEaten(World par1World,
                                 EntityPlayer par2EntityPlayer)

### writeToNBT

    public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound)

  Write the stack fields to a NBT object. Return the new NBT object.

### readFromNBT

    public void readFromNBT(NBTTagCompound par1NBTTagCompound)

  Read the stack fields from a NBT object.

### getMaxStackSize

    public int getMaxStackSize()

  Returns maximum size of the stack.

### isStackable

    public boolean isStackable()

  Returns true if the ItemStack can hold 2 or more units of the item.

### isItemStackDamageable

    public boolean isItemStackDamageable()

  true if this itemStack is damageable

### getHasSubtypes

    public boolean getHasSubtypes()

### isItemDamaged

    public boolean isItemDamaged()

  returns true when a damageable item is damaged

### getItemDamageForDisplay

    public int getItemDamageForDisplay()

  gets the damage of an itemstack, for displaying purposes

### getItemDamage

    public int getItemDamage()

  gets the damage of an itemstack

### setItemDamage

    public void setItemDamage(int par1)

  Sets the item damage of the ItemStack.

### getMaxDamage

    public int getMaxDamage()

  Returns the max damage an item in the stack can take.

### damageItem

    public void damageItem(int par1,
                           EntityLiving par2EntityLiving)

  Damages the item in the ItemStack

### hitEntity

    public void hitEntity(EntityLiving par1EntityLiving,
                          EntityPlayer par2EntityPlayer)

  Calls the corresponding fct in di

### onBlockDestroyed

    public void onBlockDestroyed(World par1World,
                                 int par2,
                                 int par3,
                                 int par4,
                                 int par5,
                                 EntityPlayer par6EntityPlayer)

### getDamageVsEntity

    public int getDamageVsEntity(Entity par1Entity)

  Returns the damage against a given entity.

### canHarvestBlock

    public boolean canHarvestBlock(Block par1Block)

  Checks if the itemStack object can harvest a specified block

### interactWith

    public boolean interactWith(EntityLiving par1EntityLiving)

### copy

    public ItemStack copy()

  Returns a new stack with the same properties.

### func_77970_a

    public static boolean func_77970_a(ItemStack par0ItemStack,
                                       ItemStack par1ItemStack)

### areItemStacksEqual

    public static boolean areItemStacksEqual(ItemStack par0ItemStack,
                                             ItemStack par1ItemStack)

  compares ItemStack argument1 with ItemStack argument2; returns true if both ItemStacks are equal

### isItemEqual

    public boolean isItemEqual(ItemStack par1ItemStack)

  compares ItemStack argument to the instance ItemStack; returns true if the Items contained in both ItemStacks are equal

### getItemName

    public String getItemName()

### copyItemStack

    public static ItemStack copyItemStack(ItemStack par0ItemStack)

  Creates a copy of a ItemStack, a null parameters will return a null.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### updateAnimation

    public void updateAnimation(World par1World,
                                Entity par2Entity,
                                int par3,
                                boolean par4)

  Called each tick as long the ItemStack in on player inventory. Used to progress the pickup animation and update maps.

### onCrafting

    public void onCrafting(World par1World,
                           EntityPlayer par2EntityPlayer,
                           int par3)

### getMaxItemUseDuration

    public int getMaxItemUseDuration()

### getItemUseAction

    public EnumAction getItemUseAction()

### onPlayerStoppedUsing

    public void onPlayerStoppedUsing(World par1World,
                                     EntityPlayer par2EntityPlayer,
                                     int par3)

  Called when the player releases the use item button. Args: world, entityplayer, itemInUseCount

### hasTagCompound

    public boolean hasTagCompound()

  Returns true if the ItemStack has an NBTTagCompound. Currently used to store enchantments.

### getTagCompound

    public NBTTagCompound getTagCompound()

  Returns the NBTTagCompound of the ItemStack.

### getEnchantmentTagList

    public NBTTagList getEnchantmentTagList()

### setTagCompound

    public void setTagCompound(NBTTagCompound par1NBTTagCompound)

  Assigns a NBTTagCompound to the ItemStack, minecraft validates that only non-stackable items can have it.

### func_82833_r

    public String func_82833_r()

### func_82834_c

    public void func_82834_c(String par1Str)

### func_82837_s

    public boolean func_82837_s()

### func_82840_a

    public List func_82840_a(EntityPlayer par1EntityPlayer,
                             boolean par2)

### hasEffect

    public boolean hasEffect()

### getRarity

    public EnumRarity getRarity()

### isItemEnchantable

    public boolean isItemEnchantable()

  True if it is a tool and has no enchantments to begin with

### addEnchantment

    public void addEnchantment(Enchantment par1Enchantment,
                               int par2)

  Adds an enchantment with a desired level on the ItemStack.

### isItemEnchanted

    public boolean isItemEnchanted()

  True if the item has enchantment data

### func_77983_a

    public void func_77983_a(String par1Str,
                             NBTBase par2NBTBase)

### func_82835_x

    public boolean func_82835_x()

### func_82839_y

    public boolean func_82839_y()

### func_82842_a

    public void func_82842_a(EntityItemFrame par1EntityItemFrame)

### func_82836_z

    public EntityItemFrame func_82836_z()

### func_82838_A

    public int func_82838_A()

### func_82841_c

    public void func_82841_c(int par1)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD