类 ItemStack

所有已实现的接口:
ICapabilityProvider, ICapabilityProviderImpl<ItemStack>, ICapabilitySerializable<CompoundTag>, IForgeItemStack, INBTSerializable<CompoundTag>

public final class ItemStack extends CapabilityProvider<ItemStack> implements IForgeItemStack
  • 字段详细资料

    • CODEC

      public static final com.mojang.serialization.Codec<ItemStack> CODEC
    • delegate

      @Nullable private final Holder.Reference<Item> delegate
    • capNBT

      private CompoundTag capNBT
    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • EMPTY

      public static final ItemStack EMPTY
    • ATTRIBUTE_MODIFIER_FORMAT

      public static final DecimalFormat ATTRIBUTE_MODIFIER_FORMAT
    • TAG_ENCH

      public static final String TAG_ENCH
      另请参阅:
    • TAG_DISPLAY

      public static final String TAG_DISPLAY
      另请参阅:
    • TAG_DISPLAY_NAME

      public static final String TAG_DISPLAY_NAME
      另请参阅:
    • TAG_LORE

      public static final String TAG_LORE
      另请参阅:
    • TAG_DAMAGE

      public static final String TAG_DAMAGE
      另请参阅:
    • TAG_COLOR

      public static final String TAG_COLOR
      另请参阅:
    • TAG_UNBREAKABLE

      private static final String TAG_UNBREAKABLE
      另请参阅:
    • TAG_REPAIR_COST

      private static final String TAG_REPAIR_COST
      另请参阅:
    • TAG_CAN_DESTROY_BLOCK_LIST

      private static final String TAG_CAN_DESTROY_BLOCK_LIST
      另请参阅:
    • TAG_CAN_PLACE_ON_BLOCK_LIST

      private static final String TAG_CAN_PLACE_ON_BLOCK_LIST
      另请参阅:
    • TAG_HIDE_FLAGS

      private static final String TAG_HIDE_FLAGS
      另请参阅:
    • DISABLED_ITEM_TOOLTIP

      private static final Component DISABLED_ITEM_TOOLTIP
    • DONT_HIDE_TOOLTIP

      private static final int DONT_HIDE_TOOLTIP
      另请参阅:
    • LORE_STYLE

      private static final Style LORE_STYLE
    • count

      private int count
    • popTime

      private int popTime
    • item

      @Deprecated @Nullable private final Item item
      已过时。
    • tag

      @Nullable private CompoundTag tag
    • entityRepresentation

      @Nullable private Entity entityRepresentation
    • adventureBreakCheck

      @Nullable private AdventureModeCheck adventureBreakCheck
    • adventurePlaceCheck

      @Nullable private AdventureModeCheck adventurePlaceCheck
  • 构造器详细资料

    • ItemStack

      public ItemStack(ItemLike pItem)
    • ItemStack

      public ItemStack(Holder<Item> pTag)
    • ItemStack

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

      public ItemStack(Holder<Item> pItem, int pCount)
    • ItemStack

      public ItemStack(ItemLike pItem, int pCount)
    • ItemStack

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

      private ItemStack(@Nullable Void p_282703_)
    • ItemStack

      private ItemStack(CompoundTag pCompoundTag)
  • 方法详细资料

    • getTooltipImage

      public Optional<TooltipComponent> getTooltipImage()
    • of

      public static ItemStack of(CompoundTag pCompoundTag)
    • isEmpty

      public boolean isEmpty()
    • isItemEnabled

      public boolean isItemEnabled(FeatureFlagSet pEnabledFlags)
    • split

      public ItemStack split(int pAmount)
    • copyAndClear

      public ItemStack copyAndClear()
    • getItem

      public Item getItem()
    • getItemHolder

      public Holder<Item> getItemHolder()
    • is

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

      public boolean is(Item pItem)
    • is

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

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

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

      public InteractionResult useOn(UseOnContext pContext)
    • onItemUseFirst

      public InteractionResult onItemUseFirst(UseOnContext pContext)
      指定者:
      onItemUseFirst 在接口中 IForgeItemStack
    • onItemUse

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

      public float getDestroySpeed(BlockState pState)
    • use

      public InteractionResultHolder<ItemStack> use(Level pLevel, Player pPlayer, InteractionHand pUsedHand)
    • finishUsingItem

      public ItemStack finishUsingItem(Level pLevel, LivingEntity pLivingEntity)
    • save

      public CompoundTag save(CompoundTag pCompoundTag)
    • 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 pDamage)
    • getMaxDamage

      public int getMaxDamage()
    • hurt

      public boolean hurt(int pAmount, RandomSource pRandom, @Nullable ServerPlayer pUser)
    • hurtAndBreak

      public <T extends LivingEntity> void hurtAndBreak(int pAmount, T pEntity, Consumer<T> pOnBroken)
    • isBarVisible

      public boolean isBarVisible()
    • getBarWidth

      public int getBarWidth()
    • getBarColor

      public int getBarColor()
    • overrideStackedOnOther

      public boolean overrideStackedOnOther(Slot pSlot, ClickAction pAction, Player pPlayer)
    • overrideOtherStackedOnMe

      public boolean overrideOtherStackedOnMe(ItemStack pStack, Slot pSlot, ClickAction pAction, Player pPlayer, SlotAccess pAccess)
    • hurtEnemy

      public void hurtEnemy(LivingEntity pEntity, Player pPlayer)
    • mineBlock

      public void mineBlock(Level pLevel, BlockState pState, BlockPos pPos, Player pPlayer)
    • isCorrectToolForDrops

      public boolean isCorrectToolForDrops(BlockState pState)
    • interactLivingEntity

      public InteractionResult interactLivingEntity(Player pPlayer, LivingEntity pEntity, InteractionHand pUsedHand)
    • copy

      public ItemStack copy()
    • copyWithCount

      public ItemStack copyWithCount(int pCount)
    • matches

      public static boolean matches(ItemStack pStack, ItemStack pOther)
    • isSameItem

      public static boolean isSameItem(ItemStack pStack, ItemStack pOther)
    • isSameItemSameTags

      public static boolean isSameItemSameTags(ItemStack pStack, ItemStack pOther)
    • getDescriptionId

      public String getDescriptionId()
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object
    • inventoryTick

      public void inventoryTick(Level pLevel, Entity pEntity, int pInventorySlot, boolean pIsCurrentItem)
    • onCraftedBy

      public void onCraftedBy(Level pLevel, Player pPlayer, int pAmount)
    • getUseDuration

      public int getUseDuration()
    • getUseAnimation

      public UseAnim getUseAnimation()
    • releaseUsing

      public void releaseUsing(Level pLevel, LivingEntity pLivingEntity, int pTimeLeft)
    • useOnRelease

      public boolean useOnRelease()
    • hasTag

      public boolean hasTag()
    • getTag

      @Nullable public CompoundTag getTag()
    • getOrCreateTag

      public CompoundTag getOrCreateTag()
    • getOrCreateTagElement

      public CompoundTag getOrCreateTagElement(String pKey)
    • getTagElement

      @Nullable public CompoundTag getTagElement(String pKey)
    • removeTagKey

      public void removeTagKey(String pKey)
    • getEnchantmentTags

      public ListTag getEnchantmentTags()
    • setTag

      public void setTag(@Nullable CompoundTag p_41752_)
    • getHoverName

      public Component getHoverName()
    • setHoverName

      public ItemStack setHoverName(@Nullable Component pNameComponent)
    • resetHoverName

      public void resetHoverName()
    • hasCustomHoverName

      public boolean hasCustomHoverName()
    • getTooltipLines

      public List<Component> getTooltipLines(@Nullable Player pPlayer, TooltipFlag pIsAdvanced)
    • shouldShowInTooltip

      private static boolean shouldShowInTooltip(int pHideFlags, ItemStack.TooltipPart pPart)
    • getHideFlags

      private int getHideFlags()
    • hideTooltipPart

      public void hideTooltipPart(ItemStack.TooltipPart pPart)
    • appendEnchantmentNames

      public static void appendEnchantmentNames(List<Component> pTooltipComponents, ListTag pStoredEnchantments)
    • expandBlockState

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

      public boolean hasFoil()
    • getRarity

      public Rarity getRarity()
    • isEnchantable

      public boolean isEnchantable()
    • enchant

      public void enchant(Enchantment pEnchantment, int pLevel)
    • isEnchanted

      public boolean isEnchanted()
    • addTagElement

      public void addTagElement(String pKey, Tag pTag)
    • isFramed

      public boolean isFramed()
    • setEntityRepresentation

      public void setEntityRepresentation(@Nullable Entity pEntity)
    • getFrame

      @Nullable public ItemFrame getFrame()
    • getEntityRepresentation

      @Nullable public Entity getEntityRepresentation()
    • getBaseRepairCost

      public int getBaseRepairCost()
    • setRepairCost

      public void setRepairCost(int pCost)
    • getAttributeModifiers

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

      public void addAttributeModifier(Attribute pAttribute, AttributeModifier pModifier, @Nullable EquipmentSlot pSlot)
    • getDisplayName

      public Component getDisplayName()
    • hasAdventureModePlaceTagForBlock

      public boolean hasAdventureModePlaceTagForBlock(Registry<Block> pBlockRegistry, BlockInWorld pBlock)
    • hasAdventureModeBreakTagForBlock

      public boolean hasAdventureModeBreakTagForBlock(Registry<Block> pBlockRegistry, BlockInWorld pBlock)
    • getPopTime

      public int getPopTime()
    • setPopTime

      public void setPopTime(int pPopTime)
    • getCount

      public int getCount()
    • setCount

      public void setCount(int pCount)
    • grow

      public void grow(int pIncrement)
    • shrink

      public void shrink(int pDecrement)
    • onUseTick

      public void onUseTick(Level pLevel, LivingEntity pLivingEntity, int pCount)
    • onDestroyed

      @Deprecated public void onDestroyed(ItemEntity pItemEntity)
      已过时。
    • isEdible

      public boolean isEdible()
    • deserializeNBT

      public void deserializeNBT(CompoundTag nbt)
      指定者:
      deserializeNBT 在接口中 INBTSerializable<CompoundTag>
    • forgeInit

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

      public SoundEvent getDrinkingSound()
    • getEatingSound

      public SoundEvent getEatingSound()