Package net.minecraft.src
Class ItemStack
java.lang.Object
net.minecraft.src.ItemStack
- All Implemented Interfaces:
TagOrStack
-
Field Summary
FieldsModifier and TypeFieldDescriptionintNumber of animation frames to go when receiving an item (by walking into it, for example).static final DecimalFormatintID of the item.intSize of the stack.A NBTTagMap containing data about an ItemStack. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEnchantment(Enchantment par1Enchantment, int par2) Adds an enchantment with a desired level on the ItemStack.static booleanareItemStacksEqual(ItemStack par0ItemStack, ItemStack par1ItemStack) compares ItemStack argument1 with ItemStack argument2; returns true if both ItemStacks are equalstatic booleanareItemStackTagsEqual(ItemStack par0ItemStack, ItemStack par1ItemStack) booleanattemptDamageItem(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.booleanbooleancanHarvestBlock(World world, Block block, int i, int j, int k) copy()Returns a new stack with the same properties.static ItemStackcopyItemStack(ItemStack par0ItemStack) Creates a copy of a ItemStack, a null parameters will return a null.voiddamageItem(int par1, EntityLivingBase par2EntityLivingBase) Damages the item in the ItemStackbooleanfunc_111282_a(EntityPlayer par1EntityPlayer, EntityLivingBase par2EntityLivingBase) voidfloatgetAccumulatedChance(float fDefault) com.google.common.collect.MultimapGets the attribute modifiers for this ItemStack.returns the display name of the itemstackbooleanReturns the icon index of the current stack.getItem()Returns the object corresponding to the stack.intgets the damage of an itemstackintgets the damage of an itemstack, for displaying purposesReturn the item frame this stack is on.intintReturns the max damage an item in the stack can take.intintReturns maximum size of the stack.intGet this stack's repair cost, or 0 if no repair cost is defined.intfloatgetStrVsBlock(World world, Block par1Block, int i, int j, int k) Returns the NBTTagCompound of the ItemStack.longgetTooltip(EntityPlayer par1EntityPlayer, boolean par2) Return a list of strings containing information about the itembooleanReturns true if the itemstack has a display namebooleanbooleanReturns true if the ItemStack has an NBTTagCompound.voidhitEntity(EntityLivingBase par1EntityLivingBase, EntityPlayer par2EntityPlayer) Calls the corresponding fct in dibooleanisEqual(TagOrStack tagOrStack, boolean checkIfWildcard) booleanreturns true when a damageable item is damagedbooleanTrue if it is a tool and has no enchantments to begin withbooleanTrue if the item has enchantment databooleanisItemEqual(ItemStack par1ItemStack) compares ItemStack argument to the instance ItemStack; returns true if the Items contained in both ItemStacks are equalbooleanisItemEqual(ItemStack par1ItemStack, boolean checkIfWildcard) booleantrue if this itemStack is damageablebooleanReturn whether this stack is on an item frame.booleanReturns true if the ItemStack can hold 2 or more units of the item.static ItemStackloadItemStackFromNBT(NBTTagCompound par0NBTTagCompound) booleanmatches(TagOrStack inputToCheck, boolean checkIfWildcard) voidonBlockDestroyed(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) voidonCrafting(World par1World, EntityPlayer par2EntityPlayer, int par3) onFoodEaten(World par1World, EntityPlayer par2EntityPlayer) voidonPlayerStoppedUsing(World par1World, EntityPlayer par2EntityPlayer, int par3) Called when the player releases the use item button.voidreadFromNBT(NBTTagCompound par1NBTTagCompound) Read the stack fields from a NBT object.voidsetAccumulatedChance(float fChance) voidsetItemDamage(int par1) Sets the item damage of the ItemStack.voidsetItemFrame(EntityItemFrame par1EntityItemFrame) Set the item frame this stack is on.voidsetItemName(String par1Str) Sets the item's name (used by anvil to rename the items).voidsetRepairCost(int par1) Set this stack's repair cost.setStackSize(int newStackSize) voidsetTagCompound(NBTTagCompound par1NBTTagCompound) Assigns a NBTTagCompound to the ItemStack, minecraft validates that only non-stackable items can have it.voidsetTagInfo(String par1Str, NBTBase par2NBTBase) voidsetTimeOfLastUse(long lTime) booleanbooleansplitStack(int par1) Remove the argument from the stack size.toString()booleantryPlaceItemIntoWorld(EntityPlayer par1EntityPlayer, World par2World, int par3, int par4, int par5, int par6, float par7, float par8, float par9) voidupdateAnimation(World par1World, EntityPlayer par2Entity, int par3, boolean par4) Called each tick as long the ItemStack in on player inventory.useItemRightClick(World par1World, EntityPlayer par2EntityPlayer) // +++START EDIT+++ // ---END EDIT--- Called whenever this item stack is equipped and right clicked.writeToNBT(NBTTagCompound par1NBTTagCompound) Write the stack fields to a NBT object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface api.item.tag.TagOrStack
getItemIds
-
Field Details
-
field_111284_a
-
stackSize
public int stackSizeSize of the stack. -
animationsToGo
public int animationsToGoNumber of animation frames to go when receiving an item (by walking into it, for example). -
itemID
public int itemIDID of the item. -
stackTagCompound
A NBTTagMap containing data about an ItemStack. Can only be used for non stackable items
-
-
Constructor Details
-
ItemStack
-
ItemStack
-
ItemStack
-
ItemStack
-
ItemStack
-
ItemStack
-
ItemStack
public ItemStack(int par1, int par2, int par3)
-
-
Method Details
-
loadItemStackFromNBT
-
splitStack
Remove the argument from the stack size. Return a new stack object with argument size. -
getItem
Returns the object corresponding to the stack. -
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
// +++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
-
writeToNBT
Write the stack fields to a NBT object. Return the new NBT object. -
readFromNBT
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
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
Damages the item in the ItemStack -
hitEntity
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
-
copy
Returns a new stack with the same properties.- Specified by:
copyin interfaceTagOrStack- Returns:
- A new instance of this
-
areItemStackTagsEqual
-
areItemStacksEqual
compares ItemStack argument1 with ItemStack argument2; returns true if both ItemStacks are equal -
isItemEqual
compares ItemStack argument to the instance ItemStack; returns true if the Items contained in both ItemStacks are equal -
isItemEqual
-
matches
- Specified by:
matchesin interfaceTagOrStack
-
isEqual
- Specified by:
isEqualin interfaceTagOrStack- Parameters:
tagOrStack- Tag or stack to check against this tag or stackcheckIfWildcard- If
-
getStackSize
public int getStackSize()- Specified by:
getStackSizein interfaceTagOrStack
-
setStackSize
- Specified by:
setStackSizein interfaceTagOrStack- Returns:
- This instance if it is an itemstack, or a new instance if it is a tag.
-
getUnlocalizedName
-
copyItemStack
Creates a copy of a ItemStack, a null parameters will return a null. -
toString
-
updateAnimation
Called each tick as long the ItemStack in on player inventory. Used to progress the pickup animation and update maps. -
onCrafting
-
getMaxItemUseDuration
public int getMaxItemUseDuration() -
getItemUseAction
-
onPlayerStoppedUsing
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
Returns the NBTTagCompound of the ItemStack. -
getEnchantmentTagList
-
setTagCompound
Assigns a NBTTagCompound to the ItemStack, minecraft validates that only non-stackable items can have it. -
getDisplayName
returns the display name of the itemstack -
setItemName
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
Return a list of strings containing information about the item -
hasEffect
public boolean hasEffect() -
getRarity
-
isItemEnchantable
public boolean isItemEnchantable()True if it is a tool and has no enchantments to begin with -
addEnchantment
Adds an enchantment with a desired level on the ItemStack. -
isItemEnchanted
public boolean isItemEnchanted()True if the item has enchantment data -
setTagInfo
-
canEditBlocks
public boolean canEditBlocks() -
isOnItemFrame
public boolean isOnItemFrame()Return whether this stack is on an item frame. -
setItemFrame
Set the item frame this stack is on. -
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
-
getStrVsBlock
-
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()
-