Class ItemStack

java.lang.Object
net.minecraft.src.ItemStack
All Implemented Interfaces:
TagOrStack

public final class ItemStack extends Object implements TagOrStack
  • Field Details

    • field_111284_a

      public static final DecimalFormat field_111284_a
    • 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 Details

    • 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 Details

    • 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 Icon getIconIndex()
      Returns the icon index of the current stack.
    • getItemSpriteNumber

      public int getItemSpriteNumber()
    • tryPlaceItemIntoWorld

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

      public ItemStack useItemRightClick(World par1World, EntityPlayer par2EntityPlayer)
      // +++START EDIT+++ // ---END EDIT--- 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.
    • attemptDamageItem

      public boolean attemptDamageItem(int par1, Random par2Random)
      Attempts to damage the ItemStack with par1 amount of damage, If the ItemStack has the Unbreaking enchantment there is a chance for each point of damage to be negated. Returns true if it takes more damage than getMaxDamage(). Returns false otherwise or if the ItemStack can't be damaged or if all points of damage are negated.
    • damageItem

      public void damageItem(int par1, EntityLivingBase par2EntityLivingBase)
      Damages the item in the ItemStack
    • hitEntity

      public void hitEntity(EntityLivingBase par1EntityLivingBase, EntityPlayer par2EntityPlayer)
      Calls the corresponding fct in di
    • onBlockDestroyed

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

      public boolean func_111282_a(EntityPlayer par1EntityPlayer, EntityLivingBase par2EntityLivingBase)
    • copy

      public ItemStack copy()
      Returns a new stack with the same properties.
      Specified by:
      copy in interface TagOrStack
      Returns:
      A new instance of this
    • areItemStackTagsEqual

      public static boolean areItemStackTagsEqual(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
    • isItemEqual

      public boolean isItemEqual(ItemStack par1ItemStack, boolean checkIfWildcard)
    • matches

      public boolean matches(TagOrStack inputToCheck, boolean checkIfWildcard)
      Specified by:
      matches in interface TagOrStack
    • isEqual

      public boolean isEqual(TagOrStack tagOrStack, boolean checkIfWildcard)
      Specified by:
      isEqual in interface TagOrStack
      Parameters:
      tagOrStack - Tag or stack to check against this tag or stack
      checkIfWildcard - If
    • getStackSize

      public int getStackSize()
      Specified by:
      getStackSize in interface TagOrStack
    • setStackSize

      public ItemStack setStackSize(int newStackSize)
      Specified by:
      setStackSize in interface TagOrStack
      Returns:
      This instance if it is an itemstack, or a new instance if it is a tag.
    • getUnlocalizedName

      public String getUnlocalizedName()
    • 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, EntityPlayer 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.
    • getDisplayName

      public String getDisplayName()
      returns the display name of the itemstack
    • setItemName

      public void setItemName(String par1Str)
      Sets the item's name (used by anvil to rename the items).
    • func_135074_t

      public void func_135074_t()
    • hasDisplayName

      public boolean hasDisplayName()
      Returns true if the itemstack has a display name
    • getTooltip

      public List getTooltip(EntityPlayer par1EntityPlayer, boolean par2)
      Return a list of strings containing information about the item
    • 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
    • setTagInfo

      public void setTagInfo(String par1Str, NBTBase par2NBTBase)
    • canEditBlocks

      public boolean canEditBlocks()
    • isOnItemFrame

      public boolean isOnItemFrame()
      Return whether this stack is on an item frame.
    • setItemFrame

      public void setItemFrame(EntityItemFrame par1EntityItemFrame)
      Set the item frame this stack is on.
    • getItemFrame

      public EntityItemFrame getItemFrame()
      Return the item frame this stack is on. Returns null if not on an item frame.
    • getRepairCost

      public int getRepairCost()
      Get this stack's repair cost, or 0 if no repair cost is defined.
    • setRepairCost

      public void setRepairCost(int par1)
      Set this stack's repair cost.
    • canHarvestBlock

      public boolean canHarvestBlock(World world, Block block, int i, int j, int k)
    • getStrVsBlock

      public float getStrVsBlock(World world, Block par1Block, int i, int j, int k)
    • getTimeOfLastUse

      public long getTimeOfLastUse()
    • setTimeOfLastUse

      public void setTimeOfLastUse(long lTime)
    • getAccumulatedChance

      public float getAccumulatedChance(float fDefault)
    • setAccumulatedChance

      public void setAccumulatedChance(float fChance)
    • getAttributeModifiers

      public com.google.common.collect.Multimap getAttributeModifiers()
      Gets the attribute modifiers for this ItemStack.\nWill check for an NBT tag list containing modifiers for the stack.
    • shouldApplyAttributesWhenHeld

      public boolean shouldApplyAttributesWhenHeld()
    • shouldApplyAttributesWhenWorn

      public boolean shouldApplyAttributesWhenWorn()