public final class ItemStack extends java.lang.Object implements ICapabilitySerializable<NBTTagCompound>
Modifier and Type | Field and Description |
---|---|
static java.text.DecimalFormat |
DECIMALFORMAT |
static ItemStack |
EMPTY |
Constructor and Description |
---|
ItemStack(Block blockIn) |
ItemStack(Block blockIn,
int amount) |
ItemStack(Block blockIn,
int amount,
int meta) |
ItemStack(Item itemIn) |
ItemStack(Item itemIn,
int amount) |
ItemStack(Item itemIn,
int amount,
int meta) |
ItemStack(Item itemIn,
int amount,
int meta,
NBTTagCompound capNBT) |
ItemStack(NBTTagCompound compound) |
Modifier and Type | Method and Description |
---|---|
void |
addAttributeModifier(java.lang.String attributeName,
AttributeModifier modifier,
EntityEquipmentSlot equipmentSlot) |
void |
addEnchantment(Enchantment ench,
int level) |
boolean |
areCapsCompatible(ItemStack other) |
static boolean |
areItemsEqual(ItemStack stackA,
ItemStack stackB) |
static boolean |
areItemsEqualIgnoreDurability(ItemStack stackA,
ItemStack stackB) |
static boolean |
areItemStacksEqual(ItemStack stackA,
ItemStack stackB) |
static boolean |
areItemStacksEqualUsingNBTShareTag(ItemStack stackA,
ItemStack stackB)
Modeled after ItemStack.areItemStacksEqual
Uses Item.getNBTShareTag for comparison instead of NBT and capabilities.
|
static boolean |
areItemStackShareTagsEqual(ItemStack stackA,
ItemStack stackB)
Modeled after ItemStack.areItemStackTagsEqual
Uses Item.getNBTShareTag for comparison instead of NBT and capabilities.
|
static boolean |
areItemStackTagsEqual(ItemStack stackA,
ItemStack stackB) |
boolean |
attemptDamageItem(int amount,
java.util.Random rand,
EntityPlayerMP damager) |
boolean |
canDestroy(Block blockIn) |
boolean |
canEditBlocks() |
boolean |
canHarvestBlock(IBlockState blockIn) |
boolean |
canPlaceOn(Block blockIn) |
void |
clearCustomName() |
ItemStack |
copy() |
void |
damageItem(int amount,
EntityLivingBase entityIn) |
void |
deserializeNBT(NBTTagCompound nbt) |
boolean |
doesSneakBypassUse(IBlockAccess world,
BlockPos pos,
EntityPlayer player)
Should this item, when held, allow sneak-clicks to pass through to the underlying block?
|
int |
getAnimationsToGo() |
com.google.common.collect.Multimap<java.lang.String,AttributeModifier> |
getAttributeModifiers(EntityEquipmentSlot equipmentSlot) |
<T> T |
getCapability(Capability<T> capability,
EnumFacing facing)
Retrieves the handler for the capability requested on the specific side.
|
int |
getCount() |
float |
getDestroySpeed(IBlockState blockIn) |
java.lang.String |
getDisplayName() |
NBTTagList |
getEnchantmentTagList() |
boolean |
getHasSubtypes() |
Item |
getItem() |
int |
getItemDamage() |
EntityItemFrame |
getItemFrame() |
EnumAction |
getItemUseAction() |
int |
getMaxDamage() |
int |
getMaxItemUseDuration() |
int |
getMaxStackSize() |
int |
getMetadata() |
NBTTagCompound |
getOrCreateSubCompound(java.lang.String key) |
EnumRarity |
getRarity() |
int |
getRepairCost() |
NBTTagCompound |
getSubCompound(java.lang.String key) |
NBTTagCompound |
getTagCompound() |
ITextComponent |
getTextComponent() |
java.util.List<java.lang.String> |
getTooltip(EntityPlayer playerIn,
ITooltipFlag advanced) |
java.lang.String |
getUnlocalizedName() |
void |
grow(int quantity) |
boolean |
hasCapability(Capability<?> capability,
EnumFacing facing)
Determines if this object has support for the capability in question on the specific side.
|
boolean |
hasDisplayName() |
boolean |
hasEffect() |
boolean |
hasTagCompound() |
void |
hitEntity(EntityLivingBase entityIn,
EntityPlayer playerIn) |
boolean |
interactWithEntity(EntityPlayer playerIn,
EntityLivingBase entityIn,
EnumHand hand) |
boolean |
isEmpty() |
boolean |
isItemDamaged() |
boolean |
isItemEnchantable() |
boolean |
isItemEnchanted() |
boolean |
isItemEqual(ItemStack other) |
boolean |
isItemEqualIgnoreDurability(ItemStack stack) |
boolean |
isItemStackDamageable() |
boolean |
isOnItemFrame() |
boolean |
isStackable() |
void |
onBlockDestroyed(World worldIn,
IBlockState blockIn,
BlockPos pos,
EntityPlayer playerIn) |
void |
onCrafting(World worldIn,
EntityPlayer playerIn,
int amount) |
EnumActionResult |
onItemUse(EntityPlayer playerIn,
World worldIn,
BlockPos pos,
EnumHand hand,
EnumFacing side,
float hitX,
float hitY,
float hitZ) |
ItemStack |
onItemUseFinish(World worldIn,
EntityLivingBase entityLiving) |
EnumActionResult |
onItemUseFirst(EntityPlayer playerIn,
World worldIn,
BlockPos pos,
EnumHand hand,
EnumFacing side,
float hitX,
float hitY,
float hitZ) |
void |
onPlayerStoppedUsing(World worldIn,
EntityLivingBase entityLiving,
int timeLeft) |
static void |
registerFixes(DataFixer fixer) |
void |
removeSubCompound(java.lang.String key) |
NBTTagCompound |
serializeNBT() |
void |
setAnimationsToGo(int animations) |
void |
setCount(int size) |
void |
setItemDamage(int meta) |
void |
setItemFrame(EntityItemFrame frame) |
void |
setRepairCost(int cost) |
ItemStack |
setStackDisplayName(java.lang.String displayName) |
void |
setTagCompound(NBTTagCompound nbt) |
void |
setTagInfo(java.lang.String key,
NBTBase value) |
ItemStack |
setTranslatableName(java.lang.String p_190924_1_) |
void |
shrink(int quantity) |
ItemStack |
splitStack(int amount) |
java.lang.String |
toString() |
void |
updateAnimation(World worldIn,
Entity entityIn,
int inventorySlot,
boolean isCurrentItem) |
ActionResult<ItemStack> |
useItemRightClick(World worldIn,
EntityPlayer playerIn,
EnumHand hand) |
NBTTagCompound |
writeToNBT(NBTTagCompound nbt) |
public static final ItemStack EMPTY
public static final java.text.DecimalFormat DECIMALFORMAT
public ItemStack(Block blockIn)
public ItemStack(Block blockIn, int amount)
public ItemStack(Block blockIn, int amount, int meta)
public ItemStack(Item itemIn)
public ItemStack(Item itemIn, int amount)
public ItemStack(Item itemIn, int amount, int meta)
public ItemStack(Item itemIn, int amount, int meta, @Nullable NBTTagCompound capNBT)
public ItemStack(NBTTagCompound compound)
public boolean isEmpty()
public static void registerFixes(DataFixer fixer)
public ItemStack splitStack(int amount)
public Item getItem()
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
public EnumActionResult onItemUseFirst(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
public float getDestroySpeed(IBlockState blockIn)
public ActionResult<ItemStack> useItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand)
public ItemStack onItemUseFinish(World worldIn, EntityLivingBase entityLiving)
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
public int getMaxStackSize()
public boolean isStackable()
public boolean isItemStackDamageable()
public boolean getHasSubtypes()
public boolean isItemDamaged()
public int getItemDamage()
public int getMetadata()
public void setItemDamage(int meta)
public int getMaxDamage()
public boolean attemptDamageItem(int amount, java.util.Random rand, @Nullable EntityPlayerMP damager)
public void damageItem(int amount, EntityLivingBase entityIn)
public void hitEntity(EntityLivingBase entityIn, EntityPlayer playerIn)
public void onBlockDestroyed(World worldIn, IBlockState blockIn, BlockPos pos, EntityPlayer playerIn)
public boolean canHarvestBlock(IBlockState blockIn)
public boolean interactWithEntity(EntityPlayer playerIn, EntityLivingBase entityIn, EnumHand hand)
public ItemStack copy()
public static boolean areItemStackTagsEqual(ItemStack stackA, ItemStack stackB)
public static boolean areItemsEqualIgnoreDurability(ItemStack stackA, ItemStack stackB)
public boolean isItemEqual(ItemStack other)
public boolean isItemEqualIgnoreDurability(ItemStack stack)
public java.lang.String getUnlocalizedName()
public java.lang.String toString()
toString
in class java.lang.Object
public void updateAnimation(World worldIn, Entity entityIn, int inventorySlot, boolean isCurrentItem)
public void onCrafting(World worldIn, EntityPlayer playerIn, int amount)
public int getMaxItemUseDuration()
public EnumAction getItemUseAction()
public void onPlayerStoppedUsing(World worldIn, EntityLivingBase entityLiving, int timeLeft)
public boolean hasTagCompound()
@Nullable public NBTTagCompound getTagCompound()
public NBTTagCompound getOrCreateSubCompound(java.lang.String key)
@Nullable public NBTTagCompound getSubCompound(java.lang.String key)
public void removeSubCompound(java.lang.String key)
public NBTTagList getEnchantmentTagList()
public void setTagCompound(@Nullable NBTTagCompound nbt)
public java.lang.String getDisplayName()
public ItemStack setTranslatableName(java.lang.String p_190924_1_)
public ItemStack setStackDisplayName(java.lang.String displayName)
public void clearCustomName()
public boolean hasDisplayName()
public java.util.List<java.lang.String> getTooltip(@Nullable EntityPlayer playerIn, ITooltipFlag advanced)
public boolean hasEffect()
public EnumRarity getRarity()
public boolean isItemEnchantable()
public void addEnchantment(Enchantment ench, int level)
public boolean isItemEnchanted()
public void setTagInfo(java.lang.String key, NBTBase value)
public boolean canEditBlocks()
public boolean isOnItemFrame()
public void setItemFrame(EntityItemFrame frame)
@Nullable public EntityItemFrame getItemFrame()
public int getRepairCost()
public void setRepairCost(int cost)
public com.google.common.collect.Multimap<java.lang.String,AttributeModifier> getAttributeModifiers(EntityEquipmentSlot equipmentSlot)
public void addAttributeModifier(java.lang.String attributeName, AttributeModifier modifier, @Nullable EntityEquipmentSlot equipmentSlot)
public ITextComponent getTextComponent()
public boolean canDestroy(Block blockIn)
public boolean canPlaceOn(Block blockIn)
public int getAnimationsToGo()
public void setAnimationsToGo(int animations)
public int getCount()
public void setCount(int size)
public void grow(int quantity)
public void shrink(int quantity)
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing)
ICapabilityProvider
hasCapability
in interface ICapabilityProvider
capability
- The capability to checkfacing
- The Side to check from:
CAN BE NULL. Null is defined to represent 'internal' or 'self'@Nullable public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing)
ICapabilityProvider
getCapability
in interface ICapabilityProvider
capability
- The capability to checkfacing
- The Side to check from:
CAN BE NULL. Null is defined to represent 'internal' or 'self'ICapabilityProvider.hasCapability(Capability, EnumFacing)
would return false.public void deserializeNBT(NBTTagCompound nbt)
deserializeNBT
in interface INBTSerializable<NBTTagCompound>
public NBTTagCompound serializeNBT()
serializeNBT
in interface INBTSerializable<NBTTagCompound>
public boolean areCapsCompatible(ItemStack other)
public static boolean areItemStacksEqualUsingNBTShareTag(ItemStack stackA, ItemStack stackB)
public static boolean areItemStackShareTagsEqual(ItemStack stackA, ItemStack stackB)
public boolean doesSneakBypassUse(IBlockAccess world, BlockPos pos, EntityPlayer player)
world
- The worldpos
- Block position in worldplayer
- The Player that is wielding the item