Interface ItemMeta

All Superinterfaces:
Cloneable, ConfigurationSerializable, PersistentDataHolder
All Known Subinterfaces:
ArmorMeta, AxolotlBucketMeta, BannerMeta, BlockDataMeta, BlockStateMeta, BookMeta, BundleMeta, ColorableArmorMeta, CompassMeta, CrossbowMeta, Damageable, EnchantmentStorageMeta, FireworkEffectMeta, FireworkMeta, KnowledgeBookMeta, LeatherArmorMeta, MapMeta, MusicInstrumentMeta, OminousBottleMeta, PotionMeta, Repairable, ShieldMeta, SkullMeta, SpawnEggMeta, SuspiciousStewMeta, TropicalFishBucketMeta, WritableBookMeta

public interface ItemMeta extends Cloneable, ConfigurationSerializable, PersistentDataHolder
This type represents the storage mechanism for auxiliary item data.

An implementation will handle the creation and application for ItemMeta. This class should not be implemented by a plugin in a live environment.

  • Method Details Link icon

    • hasDisplayName Link icon

      boolean hasDisplayName()
      Checks for existence of a display name.
      Returns:
      true if this has a display name
    • getDisplayName Link icon

      @NotNull String getDisplayName()
      Gets the display name that is set.

      Plugins should check that hasDisplayName() returns true before calling this method.

      Returns:
      the display name that is set
    • setDisplayName Link icon

      void setDisplayName(@Nullable String name)
      Sets the display name.
      Parameters:
      name - the name to set
    • hasItemName Link icon

      boolean hasItemName()
      Checks for existence of an item name.
      Item name differs from display name in that it is cannot be edited by an anvil, is not styled with italics, and does not show labels.
      Returns:
      true if this has an item name
    • getItemName Link icon

      @NotNull String getItemName()
      Gets the item name that is set.
      Item name differs from display name in that it is cannot be edited by an anvil, is not styled with italics, and does not show labels.

      Plugins should check that hasItemName() returns true before calling this method.

      Returns:
      the item name that is set
    • setItemName Link icon

      void setItemName(@Nullable String name)
      Sets the item name.
      Item name differs from display name in that it is cannot be edited by an anvil, is not styled with italics, and does not show labels.
      Parameters:
      name - the name to set
    • hasLocalizedName Link icon

      @Deprecated(since="1.20.5", forRemoval=true) boolean hasLocalizedName()
      Deprecated, for removal: This API element is subject to removal in a future version.
      meta no longer exists
      Checks for existence of a localized name.
      Returns:
      true if this has a localized name
    • getLocalizedName Link icon

      @NotNull @Deprecated(since="1.20.5", forRemoval=true) String getLocalizedName()
      Deprecated, for removal: This API element is subject to removal in a future version.
      meta no longer exists
      Gets the localized display name that is set.

      Plugins should check that hasLocalizedName() returns true before calling this method.

      Returns:
      the localized name that is set
    • setLocalizedName Link icon

      @Deprecated(since="1.20.5", forRemoval=true) void setLocalizedName(@Nullable String name)
      Deprecated, for removal: This API element is subject to removal in a future version.
      meta no longer exists
      Sets the localized name.
      Parameters:
      name - the name to set
    • hasLore Link icon

      boolean hasLore()
      Checks for existence of lore.
      Returns:
      true if this has lore
    • getLore Link icon

      @Nullable List<String> getLore()
      Gets the lore that is set.

      Plugins should check if hasLore() returns true before calling this method.

      Returns:
      a list of lore that is set
    • setLore Link icon

      void setLore(@Nullable List<String> lore)
      Sets the lore for this item. Removes lore when given null.
      Parameters:
      lore - the lore that will be set
    • hasCustomModelData Link icon

      boolean hasCustomModelData()
      Checks for existence of custom model data.

      CustomModelData is an integer that may be associated client side with a custom item model.

      Returns:
      true if this has custom model data
    • getCustomModelData Link icon

      int getCustomModelData()
      Gets the custom model data that is set.

      CustomModelData is an integer that may be associated client side with a custom item model.

      Plugins should check that hasCustomModelData() returns true before calling this method.

      Returns:
      the custom model data that is set
    • getCustomModelDataComponent Link icon

      @NotNull CustomModelDataComponent getCustomModelDataComponent()
      Gets the custom model data set on this item, or creates an empty custom model data instance.

      The returned component is a snapshot of its current state and does not reflect a live view of what is on an item. After changing any value on this component, it must be set with setCustomModelDataComponent(CustomModelDataComponent) to apply the changes.

      Returns:
      component
    • setCustomModelData Link icon

      void setCustomModelData(@Nullable Integer data)
      Sets the custom model data.

      CustomModelData is an integer that may be associated client side with a custom item model.

      Parameters:
      data - the data to set, or null to clear
    • setCustomModelDataComponent Link icon

      void setCustomModelDataComponent(@Nullable CustomModelDataComponent customModelData)
      Sets the custom model data component.
      Parameters:
      customModelData - new component
    • hasEnchantable Link icon

      boolean hasEnchantable()
      Gets if the enchantable component is set.
      Returns:
      if an enchantable is set.
    • getEnchantable Link icon

      int getEnchantable()
      Gets the enchantable component. Higher values allow higher enchantments.
      Returns:
      max_stack_size
    • setEnchantable Link icon

      void setEnchantable(@Nullable Integer enchantable)
      Sets the enchantable. Higher values allow higher enchantments.
      Parameters:
      enchantable - enchantable value
    • hasEnchants Link icon

      boolean hasEnchants()
      Checks for the existence of any enchantments.
      Returns:
      true if an enchantment exists on this meta
    • hasEnchant Link icon

      boolean hasEnchant(@NotNull Enchantment ench)
      Checks for existence of the specified enchantment.
      Parameters:
      ench - enchantment to check
      Returns:
      true if this enchantment exists for this meta
    • getEnchantLevel Link icon

      int getEnchantLevel(@NotNull Enchantment ench)
      Checks for the level of the specified enchantment.
      Parameters:
      ench - enchantment to check
      Returns:
      The level that the specified enchantment has, or 0 if none
    • getEnchants Link icon

      @NotNull Map<Enchantment,Integer> getEnchants()
      Returns a copy the enchantments in this ItemMeta.
      Returns an empty map if none.
      Returns:
      An immutable copy of the enchantments
    • addEnchant Link icon

      boolean addEnchant(@NotNull Enchantment ench, int level, boolean ignoreLevelRestriction)
      Adds the specified enchantment to this item meta.
      Parameters:
      ench - Enchantment to add
      level - Level for the enchantment
      ignoreLevelRestriction - this indicates the enchantment should be applied, ignoring the level limit
      Returns:
      true if the item meta changed as a result of this call, false otherwise
    • removeEnchant Link icon

      boolean removeEnchant(@NotNull Enchantment ench)
      Removes the specified enchantment from this item meta.
      Parameters:
      ench - Enchantment to remove
      Returns:
      true if the item meta changed as a result of this call, false otherwise
    • removeEnchantments Link icon

      void removeEnchantments()
      Removes all enchantments from this item meta.
    • hasConflictingEnchant Link icon

      boolean hasConflictingEnchant(@NotNull Enchantment ench)
      Checks if the specified enchantment conflicts with any enchantments in this ItemMeta.
      Parameters:
      ench - enchantment to test
      Returns:
      true if the enchantment conflicts, false otherwise
    • addItemFlags Link icon

      void addItemFlags(@NotNull ItemFlag... itemFlags)
      Set itemflags which should be ignored when rendering a ItemStack in the Client. This Method does silently ignore double set itemFlags.
      Parameters:
      itemFlags - The hideflags which shouldn't be rendered
    • removeItemFlags Link icon

      void removeItemFlags(@NotNull ItemFlag... itemFlags)
      Remove specific set of itemFlags. This tells the Client it should render it again. This Method does silently ignore double removed itemFlags.
      Parameters:
      itemFlags - Hideflags which should be removed
    • getItemFlags Link icon

      @NotNull Set<ItemFlag> getItemFlags()
      Get current set itemFlags. The collection returned is unmodifiable.
      Returns:
      A set of all itemFlags set
    • hasItemFlag Link icon

      boolean hasItemFlag(@NotNull ItemFlag flag)
      Check if the specified flag is present on this item.
      Parameters:
      flag - the flag to check
      Returns:
      if it is present
    • isHideTooltip Link icon

      boolean isHideTooltip()
      Gets if this item has hide_tooltip set. An item with this set will not show any tooltip whatsoever.
      Returns:
      hide_tooltip
    • setHideTooltip Link icon

      void setHideTooltip(boolean hideTooltip)
      Sets if this item has hide_tooltip set. An item with this set will not show any tooltip whatsoever.
      Parameters:
      hideTooltip - new hide_tooltip
    • hasTooltipStyle Link icon

      boolean hasTooltipStyle()
      Gets if this item has a custom tooltip style.
      Returns:
      if a tooltip_style is set
    • getTooltipStyle Link icon

      @Nullable NamespacedKey getTooltipStyle()
      Gets the custom tooltip style.
      Returns:
      the tooltip style
    • setTooltipStyle Link icon

      void setTooltipStyle(@Nullable NamespacedKey tooltipStyle)
      Sets the custom tooltip style.
      Parameters:
      tooltipStyle - the new style
    • hasItemModel Link icon

      boolean hasItemModel()
      Gets if this item has a custom item model.
      Returns:
      if a item_model is set
    • getItemModel Link icon

      @Nullable NamespacedKey getItemModel()
      Gets the custom item model.
      Returns:
      the item model
    • setItemModel Link icon

      void setItemModel(@Nullable NamespacedKey itemModel)
      Sets the custom item model.
      Parameters:
      itemModel - the new model
    • isUnbreakable Link icon

      boolean isUnbreakable()
      Return if the unbreakable tag is true. An unbreakable item will not lose durability.
      Returns:
      true if the unbreakable tag is true
    • setUnbreakable Link icon

      void setUnbreakable(boolean unbreakable)
      Sets the unbreakable tag. An unbreakable item will not lose durability.
      Parameters:
      unbreakable - true if set unbreakable
    • hasEnchantmentGlintOverride Link icon

      boolean hasEnchantmentGlintOverride()
      Gets if an enchantment_glint_override is set.
      Returns:
      if an enchantment_glint_override is set
    • getEnchantmentGlintOverride Link icon

      @NotNull Boolean getEnchantmentGlintOverride()
      Sets the enchantment_glint_override. If true, the item will glint, even without enchantments; if false, the item will not glint, even with enchantments. Plugins should check hasEnchantmentGlintOverride() before calling this method.
      Returns:
      enchantment_glint_override
    • setEnchantmentGlintOverride Link icon

      void setEnchantmentGlintOverride(@Nullable Boolean override)
      Sets the enchantment_glint_override. If true, the item will glint, even without enchantments; if false, the item will not glint, even with enchantments. If null, the override will be cleared.
      Parameters:
      override - new enchantment_glint_override
    • isGlider Link icon

      boolean isGlider()
      Checks if this item is a glider. If true, this item will allow players to glide when it is equipped.
      Returns:
      glider
    • setGlider Link icon

      void setGlider(boolean glider)
      Sets if this item is a glider. If true, this item will allow players to glide when it is equipped.
      Parameters:
      glider - glider
    • isFireResistant Link icon

      @Deprecated(since="1.21.2") boolean isFireResistant()
      Checks if this item is fire_resistant. If true, it will not burn in fire or lava.
      Returns:
      fire_resistant
    • setFireResistant Link icon

      @Deprecated(since="1.21.2") void setFireResistant(boolean fireResistant)
      Sets if this item is fire_resistant. If true, it will not burn in fire or lava.
      Parameters:
      fireResistant - fire_resistant
    • hasDamageResistant Link icon

      boolean hasDamageResistant()
      Gets if this item is resistant to certain types of damage.
      Returns:
      true if a resistance is set
    • getDamageResistant Link icon

      @Nullable Tag<DamageType> getDamageResistant()
      Gets the type of damage this item will be resistant to when in entity form. Plugins should check hasDamageResistant() before calling this method.
      Returns:
      damage type
    • setDamageResistant Link icon

      void setDamageResistant(@Nullable Tag<DamageType> tag)
      Sets the type of damage this item will be resistant to when in entity form.
      Parameters:
      tag - the tag, or null to clear
    • hasMaxStackSize Link icon

      boolean hasMaxStackSize()
      Gets if the max_stack_size is set.
      Returns:
      if a max_stack_size is set.
    • getMaxStackSize Link icon

      int getMaxStackSize()
      Gets the max_stack_size. This is the maximum amount which an item will stack.
      Returns:
      max_stack_size
    • setMaxStackSize Link icon

      void setMaxStackSize(@Nullable Integer max)
      Sets the max_stack_size. This is the maximum amount which an item will stack.
      Parameters:
      max - max_stack_size, between 1 and 99 (inclusive)
    • hasRarity Link icon

      boolean hasRarity()
      Gets if the rarity is set.
      Returns:
      rarity
    • getRarity Link icon

      @NotNull ItemRarity getRarity()
      Gets the item rarity. Plugins should check hasRarity() before calling this method.
      Returns:
      rarity
    • setRarity Link icon

      void setRarity(@Nullable ItemRarity rarity)
      Sets the item rarity.
      Parameters:
      rarity - new rarity
    • hasUseRemainder Link icon

      boolean hasUseRemainder()
      Checks if the use remainder is set.
      Returns:
      if a use remainder item is set
    • getUseRemainder Link icon

      @Nullable ItemStack getUseRemainder()
      Gets the item which this item will convert to when used.

      The returned component is a snapshot of its current state and does not reflect a live view of what is on an item. After changing any value on this component, it must be set with setUseRemainder(ItemStack) to apply the changes.

      Returns:
      remainder
    • setUseRemainder Link icon

      void setUseRemainder(@Nullable ItemStack remainder)
      Sets the item which this item will convert to when used.
      Parameters:
      remainder - new item
    • hasUseCooldown Link icon

      boolean hasUseCooldown()
      Checks if the use cooldown is set.
      Returns:
      if a use cooldown is set
    • getUseCooldown Link icon

      @NotNull UseCooldownComponent getUseCooldown()
      Gets the use cooldown set on this item, or creates an empty cooldown instance.

      The returned component is a snapshot of its current state and does not reflect a live view of what is on an item. After changing any value on this component, it must be set with setUseCooldown(UseCooldownComponent) to apply the changes.

      Returns:
      cooldown
    • setUseCooldown Link icon

      void setUseCooldown(@Nullable UseCooldownComponent cooldown)
      Sets the item use cooldown.
      Parameters:
      cooldown - new cooldown
    • hasFood Link icon

      boolean hasFood()
      Checks if the food is set.
      Returns:
      if a food is set
    • getFood Link icon

      @NotNull FoodComponent getFood()
      Gets the food set on this item, or creates an empty food instance.

      The returned component is a snapshot of its current state and does not reflect a live view of what is on an item. After changing any value on this component, it must be set with setFood(FoodComponent) to apply the changes.

      Returns:
      food
    • setFood Link icon

      void setFood(@Nullable FoodComponent food)
      Sets the item food.
      Parameters:
      food - new food
    • hasConsumable Link icon

      boolean hasConsumable()
      Checks if the consumable is set.
      Returns:
      if a consumable is set
    • getConsumable Link icon

      @NotNull ConsumableComponent getConsumable()
      Gets the consumable set on this item, or creates an empty consumable instance.

      The returned component is a snapshot of its current state and does not reflect a live view of what is on an item. After changing any value on this component, it must be set with setConsumable(ConsumableComponent) to apply the changes.

      Returns:
      food
    • setConsumable Link icon

      void setConsumable(@Nullable ConsumableComponent consumable)
      Sets the item consumable.
      Parameters:
      consumable - new consumable
    • hasTool Link icon

      boolean hasTool()
      Checks if the tool is set.
      Returns:
      if a tool is set
    • getTool Link icon

      @NotNull ToolComponent getTool()
      Gets the tool set on this item, or creates an empty tool instance.

      The returned component is a snapshot of its current state and does not reflect a live view of what is on an item. After changing any value on this component, it must be set with setTool(ToolComponent) to apply the changes.

      Returns:
      tool
    • setTool Link icon

      void setTool(@Nullable ToolComponent tool)
      Sets the item tool.
      Parameters:
      tool - new tool
    • hasWeapon Link icon

      boolean hasWeapon()
      Checks if the weapon is set.
      Returns:
      if a weapon is set
    • getWeapon Link icon

      @NotNull WeaponComponent getWeapon()
      Gets the weapon set on this item, or creates an empty weapon instance.

      The returned component is a snapshot of its current state and does not reflect a live view of what is on an item. After changing any value on this component, it must be set with setWeapon(WeaponComponent) to apply the changes.

      Returns:
      weapon
    • setWeapon Link icon

      void setWeapon(@Nullable WeaponComponent weapon)
      Sets the item weapon.
      Parameters:
      weapon - new weapon
    • hasBlocksAttacks Link icon

      boolean hasBlocksAttacks()
      Checks if the BlocksAttacksComponent is set.
      Returns:
      if a BlocksAttacksComponent is set
    • getBlocksAttacks Link icon

      @NotNull BlocksAttacksComponent getBlocksAttacks()
      Gets the BlocksAttacksComponent set on this item, or creates an empty BlocksAttacksComponent instance.

      The returned component is a snapshot of its current state and does not reflect a live view of what is on an item. After changing any value on this component, it must be set with setBlocksAttacks(BlocksAttacksComponent) to apply the changes.

      Returns:
      component
    • setBlocksAttacks Link icon

      void setBlocksAttacks(@Nullable BlocksAttacksComponent blocksAttacks)
      Sets the item BlocksAttacksComponent.
      Parameters:
      blocksAttacks - new component
    • hasEquippable Link icon

      boolean hasEquippable()
      Checks if the equippable is set.
      Returns:
      if a equippable is set
    • getEquippable Link icon

      @NotNull EquippableComponent getEquippable()
      Gets the equippable set on this item, or creates an empty equippable instance.

      The returned component is a snapshot of its current state and does not reflect a live view of what is on an item. After changing any value on this component, it must be set with setEquippable(EquippableComponent) to apply the changes.

      Returns:
      equippable
    • setEquippable Link icon

      void setEquippable(@Nullable EquippableComponent equippable)
      Sets the equippable tool.
      Parameters:
      equippable - new equippable
    • hasJukeboxPlayable Link icon

      boolean hasJukeboxPlayable()
      Checks if the jukebox playable is set.
      Returns:
      if a jukebox playable is set
    • getJukeboxPlayable Link icon

      @Nullable JukeboxPlayableComponent getJukeboxPlayable()
      Gets the jukebox playable component set on this item.

      The returned component is a snapshot of its current state and does not reflect a live view of what is on an item. After changing any value on this component, it must be set with setJukeboxPlayable(org.bukkit.inventory.meta.components.JukeboxComponent) to apply the changes.

      Returns:
      component
    • setJukeboxPlayable Link icon

      void setJukeboxPlayable(@Nullable JukeboxPlayableComponent jukeboxPlayable)
      Sets the item tool.
      Parameters:
      jukeboxPlayable - new component
    • hasBreakSound Link icon

      boolean hasBreakSound()
      Gets if the break sound is set.
      Returns:
      if break sound is set
    • getBreakSound Link icon

      @Nullable Sound getBreakSound()
      Gets the sound to play when the item is broken. Plugins should check hasBreakSound() before calling this method.
      Returns:
      the sound
    • setBreakSound Link icon

      void setBreakSound(@Nullable Sound sound)
      Sets the sound to play when the item is broken.
      Parameters:
      sound - sound
    • hasAttributeModifiers Link icon

      boolean hasAttributeModifiers()
      Checks for the existence of any AttributeModifiers.
      Returns:
      true if any AttributeModifiers exist
    • getAttributeModifiers Link icon

      @Nullable Multimap<Attribute,AttributeModifier> getAttributeModifiers()
      Return an immutable copy of all Attributes and their modifiers in this ItemMeta.
      Returns null if none exist.
      Returns:
      an immutable Multimap of Attributes and their AttributeModifiers, or null if none exist
    • getAttributeModifiers Link icon

      @NotNull Multimap<Attribute,AttributeModifier> getAttributeModifiers(@NotNull EquipmentSlot slot)
      Return an immutable copy of all Attributes and their AttributeModifiers for a given EquipmentSlot.
      Any AttributeModifier that does have have a given EquipmentSlot will be returned. This is because AttributeModifiers without a slot are active in any slot.
      If there are no attributes set for the given slot, an empty map will be returned.
      Parameters:
      slot - the EquipmentSlot to check
      Returns:
      the immutable Multimap with the respective Attributes and modifiers, or an empty map if no attributes are set.
    • getAttributeModifiers Link icon

      @Nullable Collection<AttributeModifier> getAttributeModifiers(@NotNull Attribute attribute)
      Return an immutable copy of all AttributeModifiers for a given Attribute
      Parameters:
      attribute - the Attribute
      Returns:
      an immutable collection of AttributeModifiers or null if no AttributeModifiers exist for the Attribute.
      Throws:
      NullPointerException - if Attribute is null
    • addAttributeModifier Link icon

      boolean addAttributeModifier(@NotNull Attribute attribute, @NotNull AttributeModifier modifier)
      Add an Attribute and it's Modifier. AttributeModifiers can now support EquipmentSlots. If not set, the AttributeModifier will be active in ALL slots.
      Two AttributeModifiers that have the same UUID cannot exist on the same Attribute.
      Parameters:
      attribute - the Attribute to modify
      modifier - the AttributeModifier specifying the modification
      Returns:
      true if the Attribute and AttributeModifier were successfully added
      Throws:
      NullPointerException - if Attribute is null
      NullPointerException - if AttributeModifier is null
      IllegalArgumentException - if AttributeModifier already exists
    • setAttributeModifiers Link icon

      void setAttributeModifiers(@Nullable Multimap<Attribute,AttributeModifier> attributeModifiers)
      Set all Attributes and their AttributeModifiers. To clear all currently set Attributes and AttributeModifiers use null or an empty Multimap. If not null nor empty, this will filter all entries that are not-null and add them to the ItemStack.
      Parameters:
      attributeModifiers - the new Multimap containing the Attributes and their AttributeModifiers
    • removeAttributeModifier Link icon

      boolean removeAttributeModifier(@NotNull Attribute attribute)
      Remove all AttributeModifiers associated with the given Attribute. This will return false if nothing was removed.
      Parameters:
      attribute - attribute to remove
      Returns:
      true if all modifiers were removed from a given Attribute. Returns false if no attributes were removed.
      Throws:
      NullPointerException - if Attribute is null
    • removeAttributeModifier Link icon

      boolean removeAttributeModifier(@NotNull EquipmentSlot slot)
      Remove all Attributes and AttributeModifiers for a given EquipmentSlot.
      If the given EquipmentSlot is null, this will remove all AttributeModifiers that do not have an EquipmentSlot set.
      Parameters:
      slot - the EquipmentSlot to clear all Attributes and their modifiers for
      Returns:
      true if all modifiers were removed that match the given EquipmentSlot.
    • removeAttributeModifier Link icon

      boolean removeAttributeModifier(@NotNull Attribute attribute, @NotNull AttributeModifier modifier)
      Remove a specific Attribute and AttributeModifier. AttributeModifiers are matched according to their UUID.
      Parameters:
      attribute - the Attribute to remove
      modifier - the AttributeModifier to remove
      Returns:
      if any attribute modifiers were remove
      Throws:
      NullPointerException - if the Attribute is null
      NullPointerException - if the AttributeModifier is null
      See Also:
    • getAsString Link icon

      @NotNull String getAsString()
      Get this ItemMeta as an NBT string. If this ItemMeta does not have any NBT, then "{}" will be returned.

      This string should NEVER be relied upon as a serializable value. If serialization is desired, the ConfigurationSerializable API should be used instead.

      Returns:
      the NBT string
    • getAsComponentString Link icon

      @NotNull String getAsComponentString()
      Get this ItemMeta as a component-compliant string. If this ItemMeta does not contain any components, then "[]" will be returned.

      The result of this method should yield a string representing the components altered by this ItemMeta instance. When passed to ItemFactory.createItemStack(String) with a prepended item type, it will create an ItemStack that has an ItemMeta matching this ItemMeta instance exactly. Note that this method returns ONLY the components and cannot be passed to createItemStack() alone. An example may look something like this:

       ItemStack itemStack = // ... an item stack obtained from somewhere
       ItemMeta itemMeta = itemStack.getItemMeta();
      
       String components = itemMeta.getAsComponentString(); // example: "[minecraft:damage=53]"
       String itemTypeKey = itemStack.getType().getKey().toString(); // example: "minecraft:diamond_sword"
       String itemAsString = itemTypeKey + components; // results in: "minecraft:diamond_sword[minecraft:damage=53]"
      
       ItemStack recreatedItemStack = Bukkit.getItemFactory().createItemStack(itemAsString);
       assert itemStack.isSimilar(recreatedItemStack); // Should be true*
       

      *Components not represented or explicitly overridden by this ItemMeta instance will not be included in the resulting string and therefore may result in ItemStacks that do not match exactly. For example, if setDisplayName(String) is not set, then the custom name component will not be included. Or if this ItemMeta is a PotionMeta, it will not include any components related to lodestone compasses, banners, or books, etc., only components modifiable by a PotionMeta instance.

      This string should NEVER be relied upon as a serializable value. If serialization is desired, the ConfigurationSerializable API should be used instead.

      Returns:
      the component-compliant string
    • getCustomTagContainer Link icon

      @NotNull @Deprecated(since="1.14") CustomItemTagContainer getCustomTagContainer()
      Deprecated.
      this API part has been replaced by the PersistentDataHolder API. Please use PersistentDataHolder.getPersistentDataContainer() instead of this.
      Returns a public custom tag container capable of storing tags on the item. Those tags will be sent to the client with all of their content, so the client is capable of reading them. This will result in the player seeing a NBT Tag notification on the item. These tags can also be modified by the client once in creative mode
      Returns:
      the custom tag container
    • setVersion Link icon

      @Internal void setVersion(int version)
      Internal use only! Do not use under any circumstances!
      Parameters:
      version - version
      API Note:
      internal use only
    • clone Link icon

      @NotNull ItemMeta clone()