Package net.minecraft.world.item
Class ItemStack
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.item.ItemStack
- All Implemented Interfaces:
- IAttachmentHolder,- IItemStackExtension
- 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolderAttachmentHolder.AsField
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<ItemStack>private AdventureModeCheckprivate AdventureModeCheckstatic final DecimalFormatstatic final com.mojang.serialization.Codec<ItemStack>private intprivate static final Componentprivate static final intstatic final ItemStackprivate Entityprivate final ItemDeprecated.private static final com.mojang.serialization.Codec<Item>static final com.mojang.serialization.Codec<ItemStack>private static final org.slf4j.Loggerprivate static final Styleprivate intstatic final com.mojang.serialization.MapCodec<ItemStack>static final com.mojang.serialization.Codec<ItemStack>private CompoundTagprivate static final Stringprivate static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprivate static final Stringstatic final Stringprivate static final Stringprivate static final StringFields inherited from class net.neoforged.neoforge.attachment.AttachmentHolderATTACHMENTS_NBT_KEY
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprivateItemStack(Holder<Item> p_312081_, int p_41605_, Optional<CompoundTag> p_41606_) privateItemStack(Holder<Item> p_312081_, int p_41605_, Optional<CompoundTag> p_41606_, Optional<CompoundTag> attachmentsNbt) privateItemStack(CompoundTag p_41608_) ItemStack(ItemLike p_312081_, int p_41605_, Optional<CompoundTag> p_41606_) privateItemStack(ItemLike p_312081_, int p_41605_, Optional<CompoundTag> p_41606_, Optional<CompoundTag> attachmentsNbt) ItemStack(ItemLike p_41601_, int p_41602_, CompoundTag attachmentsNbt) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddAttributeModifier(Attribute p_41644_, AttributeModifier p_41645_, EquipmentSlot p_41646_) voidaddTagElement(String p_41701_, Tag p_41702_) static voidappendEnchantmentNames(List<Component> p_41710_, ListTag p_41711_) booleanNeo: Check if the attachments of this stack and another stack are compatible.copy()copyWithCount(int p_256354_) voidenchant(Enchantment p_41664_, int p_41665_) private static Collection<Component>expandBlockState(String p_41762_) finishUsingItem(Level p_41672_, LivingEntity p_41673_) com.google.common.collect.Multimap<Attribute,AttributeModifier> getAttributeModifiers(EquipmentSlot p_41639_) intintintintgetCount()intfloatgetDestroySpeed(BlockState p_41692_) getFrame()private intgetItem()intintgetOrCreateTagElement(String p_41699_) intgetTag()getTagElement(String p_41738_) getTags()getTooltipLines(Player p_41652_, TooltipFlag p_41653_) intvoidgrow(int p_41770_) booleanhasAdventureModeBreakTagForBlock(Registry<Block> p_204129_, BlockInWorld p_204130_) booleanhasAdventureModePlaceTagForBlock(Registry<Block> p_204122_, BlockInWorld p_204123_) booleanbooleanhasFoil()booleanhasTag()voidhideTooltipPart(ItemStack.TooltipPart p_41655_) booleanhurt(int p_220158_, RandomSource p_220159_, ServerPlayer p_220160_) <T extends LivingEntity>
 voidhurtAndBreak(int p_41623_, T p_41624_, Consumer<T> p_41625_) voidhurtEnemy(LivingEntity p_41641_, Player p_41642_) interactLivingEntity(Player p_41648_, LivingEntity p_41649_, InteractionHand p_41650_) voidinventoryTick(Level p_41667_, Entity p_41668_, int p_41669_, boolean p_41670_) booleanbooleanbooleanbooleanbooleanbooleanbooleanisCorrectToolForDrops(BlockState p_41736_) booleanbooleanbooleanisEdible()booleanisEmpty()booleanbooleanbooleanisFramed()booleanisItemEnabled(FeatureFlagSet p_250869_) static booleanisSameItem(ItemStack p_287761_, ItemStack p_287676_) static booleanisSameItemSameTags(ItemStack p_150943_, ItemStack p_150944_) booleanstatic booleanvoidmineBlock(Level p_41687_, BlockState p_41688_, BlockPos p_41689_, Player p_41690_) static ItemStackof(CompoundTag p_41713_) voidonCraftedBy(Level p_41679_, Player p_41680_, int p_41681_) voidonCraftedBySystem(Level p_307669_) voidonDestroyed(ItemEntity p_150925_) Deprecated.private InteractionResultonItemUse(UseOnContext p_41662_, Function<UseOnContext, InteractionResult> callback) onItemUseFirst(UseOnContext p_41662_) voidonUseTick(Level p_41732_, LivingEntity p_41733_, int p_41734_) booleanoverrideOtherStackedOnMe(ItemStack p_150933_, Slot p_150934_, ClickAction p_150935_, Player p_150936_, SlotAccess p_150937_) booleanoverrideStackedOnOther(Slot p_150927_, ClickAction p_150928_, Player p_150929_) voidreleaseUsing(Level p_41675_, LivingEntity p_41676_, int p_41677_) voidremoveTagKey(String p_41750_) voidsave(CompoundTag p_41740_) voidsetCount(int p_41765_) voidsetDamageValue(int p_41722_) voidsetEntityRepresentation(Entity p_41637_) setHoverName(Component p_41715_) voidsetPopTime(int p_41755_) voidsetRepairCost(int p_41743_) voidsetTag(CompoundTag p_41752_) private static booleanshouldShowInTooltip(int p_41627_, ItemStack.TooltipPart p_41628_) voidshrink(int p_41775_) split(int p_41621_) toString()use(Level p_41683_, Player p_41684_, InteractionHand p_41685_) useOn(UseOnContext p_41662_) booleanMethods inherited from class net.neoforged.neoforge.attachment.AttachmentHolderareAttachmentsCompatible, deserializeAttachments, getData, hasAttachments, hasData, removeData, serializeAttachments, setDataMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHoldergetData, hasData, removeData, setDataMethods inherited from interface net.neoforged.neoforge.common.extensions.IItemStackExtensioncanApplyAtEnchantingTable, canDisableShield, canElytraFly, canEquip, canGrindstoneRepair, canPerformAction, canWalkOnPowderedSnow, doesSneakBypassUse, elytraFlightTick, getAllEnchantments, getBurnTime, getCapability, getCapability, getCraftingRemainingItem, getEnchantmentLevel, getEnchantmentValue, getEntityLifespan, getEquipmentSlot, getFoodProperties, getHighlightTip, getSweepHitBox, getXpRepairRatio, hasCraftingRemainingItem, isBookEnchantable, isEnderMask, isNotReplaceableByPickAction, isPiglinCurrency, isRepairable, makesPiglinsNeutral, onArmorTick, onBlockStartBreak, onDestroyed, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onHorseArmorTick, onStopUsing, shouldCauseBlockBreakReset
- 
Field Details- 
CODEC
- 
ITEM_NON_AIR_CODEC
- 
ADVANCEMENT_ICON_CODEC
- 
ITEM_WITH_COUNT_CODEC
- 
SINGLE_ITEM_CODEC
- 
RESULT_CODEC
- 
LOGGERprivate static final org.slf4j.Logger LOGGER
- 
EMPTY
- 
ATTRIBUTE_MODIFIER_FORMAT
- 
TAG_ENCH- See Also:
 
- 
TAG_DISPLAY- See Also:
 
- 
TAG_DISPLAY_NAME- See Also:
 
- 
TAG_LORE- See Also:
 
- 
TAG_DAMAGE- See Also:
 
- 
TAG_COLOR- See Also:
 
- 
TAG_UNBREAKABLE- See Also:
 
- 
TAG_REPAIR_COST- See Also:
 
- 
TAG_CAN_DESTROY_BLOCK_LIST- See Also:
 
- 
TAG_CAN_PLACE_ON_BLOCK_LIST- See Also:
 
- 
TAG_HIDE_FLAGS- See Also:
 
- 
DISABLED_ITEM_TOOLTIP
- 
DONT_HIDE_TOOLTIPprivate static final int DONT_HIDE_TOOLTIP- See Also:
 
- 
LORE_STYLE
- 
countprivate int count
- 
popTimeprivate int popTime
- 
itemDeprecated.
- 
tag
- 
entityRepresentation
- 
adventureBreakCheck
- 
adventurePlaceCheck
 
- 
- 
Constructor Details- 
ItemStack
- 
ItemStack
- 
ItemStack
- 
ItemStack
- 
ItemStackprivate ItemStack(Holder<Item> p_312081_, int p_41605_, Optional<CompoundTag> p_41606_, Optional<CompoundTag> attachmentsNbt) 
- 
ItemStackprivate ItemStack(ItemLike p_312081_, int p_41605_, Optional<CompoundTag> p_41606_, Optional<CompoundTag> attachmentsNbt) 
- 
ItemStack
- 
ItemStack
- 
ItemStack
- 
ItemStack
- 
ItemStack
 
- 
- 
Method Details- 
getTooltipImage
- 
of
- 
isEmptypublic boolean isEmpty()
- 
isItemEnabled
- 
split
- 
copyAndClear
- 
getItem
- 
getItemHolder
- 
is
- 
is
- 
is
- 
is
- 
is
- 
getTags
- 
useOn
- 
onItemUseFirst- Specified by:
- onItemUseFirstin interface- IItemStackExtension
 
- 
onItemUseprivate InteractionResult onItemUse(UseOnContext p_41662_, Function<UseOnContext, InteractionResult> callback) 
- 
getDestroySpeed
- 
usepublic InteractionResultHolder<ItemStack> use(Level p_41683_, Player p_41684_, InteractionHand p_41685_) 
- 
finishUsingItem
- 
save
- 
getMaxStackSizepublic int getMaxStackSize()
- 
isStackablepublic boolean isStackable()
- 
isDamageableItempublic boolean isDamageableItem()
- 
isDamagedpublic boolean isDamaged()
- 
getDamageValuepublic int getDamageValue()
- 
setDamageValuepublic void setDamageValue(int p_41722_) 
- 
getMaxDamagepublic int getMaxDamage()
- 
hurt
- 
hurtAndBreak
- 
isBarVisiblepublic boolean isBarVisible()
- 
getBarWidthpublic int getBarWidth()
- 
getBarColorpublic int getBarColor()
- 
overrideStackedOnOther
- 
overrideOtherStackedOnMepublic boolean overrideOtherStackedOnMe(ItemStack p_150933_, Slot p_150934_, ClickAction p_150935_, Player p_150936_, SlotAccess p_150937_) 
- 
hurtEnemy
- 
mineBlock
- 
isCorrectToolForDrops
- 
interactLivingEntitypublic InteractionResult interactLivingEntity(Player p_41648_, LivingEntity p_41649_, InteractionHand p_41650_) 
- 
copy
- 
copyWithCount
- 
matches
- 
isSameItem
- 
isSameItemSameTags
- 
areAttachmentsCompatibleNeo: Check if the attachments of this stack and another stack are compatible. If not, they cannot be stacked.
- 
getDescriptionId
- 
toString
- 
inventoryTick
- 
onCraftedBy
- 
onCraftedBySystem
- 
getUseDurationpublic int getUseDuration()
- 
getUseAnimation
- 
releaseUsing
- 
useOnReleasepublic boolean useOnRelease()
- 
hasTagpublic boolean hasTag()
- 
getTag
- 
getOrCreateTag
- 
getOrCreateTagElement
- 
getTagElement
- 
removeTagKey
- 
getEnchantmentTags
- 
setTag
- 
getHoverName
- 
setHoverName
- 
resetHoverNamepublic void resetHoverName()
- 
hasCustomHoverNamepublic boolean hasCustomHoverName()
- 
getTooltipLines
- 
shouldShowInTooltip
- 
getHideFlagsprivate int getHideFlags()
- 
hideTooltipPart
- 
appendEnchantmentNames
- 
expandBlockState
- 
hasFoilpublic boolean hasFoil()
- 
getRarity
- 
isEnchantablepublic boolean isEnchantable()
- 
enchant
- 
isEnchantedpublic boolean isEnchanted()
- 
addTagElement
- 
isFramedpublic boolean isFramed()
- 
setEntityRepresentation
- 
getFrame
- 
getEntityRepresentation
- 
getBaseRepairCostpublic int getBaseRepairCost()
- 
setRepairCostpublic void setRepairCost(int p_41743_) 
- 
getAttributeModifierspublic com.google.common.collect.Multimap<Attribute,AttributeModifier> getAttributeModifiers(EquipmentSlot p_41639_) 
- 
addAttributeModifierpublic void addAttributeModifier(Attribute p_41644_, AttributeModifier p_41645_, @Nullable EquipmentSlot p_41646_) 
- 
getDisplayName
- 
hasAdventureModePlaceTagForBlock
- 
hasAdventureModeBreakTagForBlock
- 
getPopTimepublic int getPopTime()
- 
setPopTimepublic void setPopTime(int p_41755_) 
- 
getCountpublic int getCount()
- 
setCountpublic void setCount(int p_41765_) 
- 
growpublic void grow(int p_41770_) 
- 
shrinkpublic void shrink(int p_41775_) 
- 
onUseTick
- 
onDestroyedDeprecated.Forge: Useinvalid @linkplaindamage source sensitive version 
- 
isEdiblepublic boolean isEdible()
- 
getDrinkingSound
- 
getEatingSound
 
- 
invalid @linkplain