Class ItemStack

All Implemented Interfaces:
ICapabilityProvider, ICapabilityProviderImpl<ItemStack>, ICapabilitySerializable<CompoundTag>, IForgeItemStack, INBTSerializable<CompoundTag>

public final class ItemStack extends CapabilityProvider<ItemStack> implements IForgeItemStack
  • Field Details

  • Constructor Details

    • ItemStack

      public ItemStack(ItemLike p_41599_)
    • ItemStack

      public ItemStack(Holder<Item> p_204116_)
    • ItemStack

      private ItemStack(ItemLike p_41604_, int p_41605_, Optional<CompoundTag> p_41606_)
    • ItemStack

      public ItemStack(Holder<Item> p_220155_, int p_220156_)
    • ItemStack

      public ItemStack(ItemLike p_41601_, int p_41602_)
    • ItemStack

      public ItemStack(ItemLike p_41604_, int p_41605_, @Nullable CompoundTag p_41606_)
    • ItemStack

      private ItemStack(CompoundTag p_41608_)
  • Method Details

    • getTooltipImage

      public Optional<TooltipComponent> getTooltipImage()
    • updateEmptyCacheFlag

      private void updateEmptyCacheFlag()
    • of

      public static ItemStack of(CompoundTag p_41713_)
    • isEmpty

      public boolean isEmpty()
    • isItemEnabled

      public boolean isItemEnabled(FeatureFlagSet p_250869_)
    • split

      public ItemStack split(int p_41621_)
    • getItem

      public Item getItem()
    • getItemHolder

      public Holder<Item> getItemHolder()
    • is

      public boolean is(TagKey<Item> p_204118_)
    • is

      public boolean is(Item p_150931_)
    • is

      public boolean is(Predicate<Holder<Item>> p_220168_)
    • is

      public boolean is(Holder<Item> p_220166_)
    • getTags

      public Stream<TagKey<Item>> getTags()
    • useOn

      public InteractionResult useOn(UseOnContext p_41662_)
    • onItemUseFirst

      public InteractionResult onItemUseFirst(UseOnContext p_41662_)
      Specified by:
      onItemUseFirst in interface IForgeItemStack
    • onItemUse

      private InteractionResult onItemUse(UseOnContext p_41662_, Function<UseOnContext,InteractionResult> callback)
    • getDestroySpeed

      public float getDestroySpeed(BlockState p_41692_)
    • use

      public InteractionResultHolder<ItemStack> use(Level p_41683_, Player p_41684_, InteractionHand p_41685_)
    • finishUsingItem

      public ItemStack finishUsingItem(Level p_41672_, LivingEntity p_41673_)
    • save

      public CompoundTag save(CompoundTag p_41740_)
    • getMaxStackSize

      public int getMaxStackSize()
    • isStackable

      public boolean isStackable()
    • isDamageableItem

      public boolean isDamageableItem()
    • isDamaged

      public boolean isDamaged()
    • getDamageValue

      public int getDamageValue()
    • setDamageValue

      public void setDamageValue(int p_41722_)
    • getMaxDamage

      public int getMaxDamage()
    • hurt

      public boolean hurt(int p_220158_, RandomSource p_220159_, @Nullable ServerPlayer p_220160_)
    • hurtAndBreak

      public <T extends LivingEntity> void hurtAndBreak(int p_41623_, T p_41624_, Consumer<T> p_41625_)
    • isBarVisible

      public boolean isBarVisible()
    • getBarWidth

      public int getBarWidth()
    • getBarColor

      public int getBarColor()
    • overrideStackedOnOther

      public boolean overrideStackedOnOther(Slot p_150927_, ClickAction p_150928_, Player p_150929_)
    • overrideOtherStackedOnMe

      public boolean overrideOtherStackedOnMe(ItemStack p_150933_, Slot p_150934_, ClickAction p_150935_, Player p_150936_, SlotAccess p_150937_)
    • hurtEnemy

      public void hurtEnemy(LivingEntity p_41641_, Player p_41642_)
    • mineBlock

      public void mineBlock(Level p_41687_, BlockState p_41688_, BlockPos p_41689_, Player p_41690_)
    • isCorrectToolForDrops

      public boolean isCorrectToolForDrops(BlockState p_41736_)
    • interactLivingEntity

      public InteractionResult interactLivingEntity(Player p_41648_, LivingEntity p_41649_, InteractionHand p_41650_)
    • copy

      public ItemStack copy()
    • copyWithCount

      public ItemStack copyWithCount(int p_256354_)
    • tagMatches

      public static boolean tagMatches(ItemStack p_41659_, ItemStack p_41660_)
    • matches

      public static boolean matches(ItemStack p_41729_, ItemStack p_41730_)
    • matches

      private boolean matches(ItemStack p_41745_)
    • isSame

      public static boolean isSame(ItemStack p_41747_, ItemStack p_41748_)
    • sameItem

      public boolean sameItem(ItemStack p_41657_)
    • isSameItemSameTags

      public static boolean isSameItemSameTags(ItemStack p_150943_, ItemStack p_150944_)
    • getDescriptionId

      public String getDescriptionId()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • inventoryTick

      public void inventoryTick(Level p_41667_, Entity p_41668_, int p_41669_, boolean p_41670_)
    • onCraftedBy

      public void onCraftedBy(Level p_41679_, Player p_41680_, int p_41681_)
    • getUseDuration

      public int getUseDuration()
    • getUseAnimation

      public UseAnim getUseAnimation()
    • releaseUsing

      public void releaseUsing(Level p_41675_, LivingEntity p_41676_, int p_41677_)
    • useOnRelease

      public boolean useOnRelease()
    • hasTag

      public boolean hasTag()
    • getTag

      @Nullable public CompoundTag getTag()
    • getOrCreateTag

      public CompoundTag getOrCreateTag()
    • getOrCreateTagElement

      public CompoundTag getOrCreateTagElement(String p_41699_)
    • getTagElement

      @Nullable public CompoundTag getTagElement(String p_41738_)
    • removeTagKey

      public void removeTagKey(String p_41750_)
    • getEnchantmentTags

      public ListTag getEnchantmentTags()
    • setTag

      public void setTag(@Nullable CompoundTag p_41752_)
    • getHoverName

      public Component getHoverName()
    • setHoverName

      public ItemStack setHoverName(@Nullable Component p_41715_)
    • resetHoverName

      public void resetHoverName()
    • hasCustomHoverName

      public boolean hasCustomHoverName()
    • getTooltipLines

      public List<Component> getTooltipLines(@Nullable Player p_41652_, TooltipFlag p_41653_)
    • shouldShowInTooltip

      private static boolean shouldShowInTooltip(int p_41627_, ItemStack.TooltipPart p_41628_)
    • getHideFlags

      private int getHideFlags()
    • hideTooltipPart

      public void hideTooltipPart(ItemStack.TooltipPart p_41655_)
    • appendEnchantmentNames

      public static void appendEnchantmentNames(List<Component> p_41710_, ListTag p_41711_)
    • expandBlockState

      private static Collection<Component> expandBlockState(String p_41762_)
    • hasFoil

      public boolean hasFoil()
    • getRarity

      public Rarity getRarity()
    • isEnchantable

      public boolean isEnchantable()
    • enchant

      public void enchant(Enchantment p_41664_, int p_41665_)
    • isEnchanted

      public boolean isEnchanted()
    • addTagElement

      public void addTagElement(String p_41701_, Tag p_41702_)
    • isFramed

      public boolean isFramed()
    • setEntityRepresentation

      public void setEntityRepresentation(@Nullable Entity p_41637_)
    • getFrame

      @Nullable public ItemFrame getFrame()
    • getEntityRepresentation

      @Nullable public Entity getEntityRepresentation()
    • getBaseRepairCost

      public int getBaseRepairCost()
    • setRepairCost

      public void setRepairCost(int p_41743_)
    • getAttributeModifiers

      public com.google.common.collect.Multimap<Attribute,AttributeModifier> getAttributeModifiers(EquipmentSlot p_41639_)
    • addAttributeModifier

      public void addAttributeModifier(Attribute p_41644_, AttributeModifier p_41645_, @Nullable EquipmentSlot p_41646_)
    • getDisplayName

      public Component getDisplayName()
    • hasAdventureModePlaceTagForBlock

      public boolean hasAdventureModePlaceTagForBlock(Registry<Block> p_204122_, BlockInWorld p_204123_)
    • hasAdventureModeBreakTagForBlock

      public boolean hasAdventureModeBreakTagForBlock(Registry<Block> p_204129_, BlockInWorld p_204130_)
    • getPopTime

      public int getPopTime()
    • setPopTime

      public void setPopTime(int p_41755_)
    • getCount

      public int getCount()
    • setCount

      public void setCount(int p_41765_)
    • grow

      public void grow(int p_41770_)
    • shrink

      public void shrink(int p_41775_)
    • onUseTick

      public void onUseTick(Level p_41732_, LivingEntity p_41733_, int p_41734_)
    • onDestroyed

      @Deprecated public void onDestroyed(ItemEntity p_150925_)
    • isEdible

      public boolean isEdible()
    • deserializeNBT

      public void deserializeNBT(CompoundTag nbt)
      Specified by:
      deserializeNBT in interface INBTSerializable<CompoundTag>
    • forgeInit

      private void forgeInit()
      Set up forge's ItemStack additions.
    • getDrinkingSound

      public SoundEvent getDrinkingSound()
    • getEatingSound

      public SoundEvent getEatingSound()