Interface GegenstandMeta

All Superinterfaces:
BestaendigeDatenInhaber, Cloneable, KonfigurationsSerialisierbar
All Known Subinterfaces:
ArmbrustMeta, AusgeburtsEiMeta, AxolotlEimerMeta, BannerMeta, Beschaedigbar, BlockDatenMeta, BlockZustandMeta, BuchMeta, BuendelMeta, ErkenntnisBuchMeta, FaerbbareRuestungMeta, FeuerwerkEffektMeta, FeuerwerkMeta, KarteMeta, KompassMeta, LederRuestungMeta, MusikInstrumentMeta, Reparierbar, RuestungMeta, SchaedelMeta, TropischerFischEimerMeta, VerdaechtigeSuppeMeta, VerzauberungsAufbewahrungMeta, ZaubertrankMeta

public interface GegenstandMeta extends Cloneable, KonfigurationsSerialisierbar, BestaendigeDatenInhaber
This type represents the storage mechanism for auxiliary item data.

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

  • Method Details

    • hasDisplayName

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

      @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

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

      boolean hasLocalizedName()
      Checks for existence of a localized name.
      Returns:
      true if this has a localized name
    • getLocalizedName

      @NotNull String getLocalizedName()
      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

      void setLocalizedName(@Nullable String name)
      Sets the localized name.
      Parameters:
      name - the name to set
    • hasLore

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

      @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

      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

      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

      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
    • setCustomModelData

      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
    • hasEnchants

      boolean hasEnchants()
      Checks for the existence of any verzauberungen.
      Returns:
      true if an verzauberung exists on this meta
    • hasEnchant

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

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

      @NotNull Map<Verzauberung,Integer> getEnchants()
      Returns a copy the verzauberungen in this GegenstandMeta.
      Returns an empty karte if none.
      Returns:
      An immutable copy of the verzauberungen
    • addEnchant

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

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

      boolean hasConflictingEnchant(@NotNull Verzauberung ench)
      Checks if the specified verzauberung conflicts with any verzauberungen in this GegenstandMeta.
      Parameters:
      ench - verzauberung to test
      Returns:
      true if the verzauberung conflicts, false otherwise
    • addItemFlags

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

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

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

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

      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

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

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

      @Nullable Multimap<Merkmal,MerkmalModifizierer> getAttributeModifiers()
      Return an immutable copy of all Attributes and their modifiers in this GegenstandMeta.
      Returns null if none exist.
      Returns:
      an immutable Multimap of Attributes and their AttributeModifiers, or null if none exist
    • getAttributeModifiers

      @NotNull Multimap<Merkmal,MerkmalModifizierer> getAttributeModifiers(@NotNull AusstattungsSpalte slot)
      Return an immutable copy of all Merkmals and their MerkmalModifizierers for a given AusstattungsSpalte.
      Any MerkmalModifizierer that does have have a given AusstattungsSpalte 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 karte will be returned.
      Parameters:
      slot - the AusstattungsSpalte to check
      Returns:
      the immutable Multimap with the respective Attributes and modifiers, or an empty karte if no attributes are set.
    • getAttributeModifiers

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

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

      void setAttributeModifiers(@Nullable Multimap<Merkmal,MerkmalModifizierer> attributeModifiers)
      Set all Merkmals and their MerkmalModifizierers. 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 GegenstandsStapel.
      Parameters:
      attributeModifiers - the new Multimap containing the Attributes and their AttributeModifiers
    • removeAttributeModifier

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

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

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

      @NotNull String getAsString()
      Get this GegenstandMeta as an NBT string.

      This string should not be relied upon as a serializable value. If serialisierung is desired, the KonfigurationsSerialisierbar API should be used instead.

      Returns:
      the NBT string
    • getCustomTagContainer

      @NotNull @Deprecated CustomItemTagContainer getCustomTagContainer()
      Deprecated.
      this API part has been replaced by the BestaendigeDatenInhaber API. Please use BestaendigeDatenInhaber.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 spieler seeing a NBT Etikett notification on the item. These tags can also be modified by the client once in creative mode
      Returns:
      the custom tag container
    • setVersion

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

      @NotNull GegenstandMeta clone()