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
An implementation will handle the creation and application for GegenstandMeta. This class should not be implemented by a zusatzmodul in a live environment.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addAttributeModifier
(Merkmal merkmal, MerkmalModifizierer modifier) Add an Merkmal and it's Modifier.boolean
addEnchant
(Verzauberung ench, int level, boolean ignoreLevelRestriction) Adds the specified verzauberung to this item meta.void
addItemFlags
(GegenstandsKennzeichnung... gegenstandsKennzeichnungs) Set itemflags which should be ignored when rendering a GegenstandsStapel in the Client.clone()
Get this GegenstandMeta as an NBT string.Return an immutable copy of all Attributes and their modifiers in this GegenstandMeta.
Returns null if none exist.Return an immutable copy of allMerkmal
s and theirMerkmalModifizierer
s for a givenAusstattungsSpalte
.
AnyMerkmalModifizierer
that does have have a givenAusstattungsSpalte
will be returned.getAttributeModifiers
(Merkmal merkmal) Return an immutable copy of allMerkmalModifizierer
s for a givenMerkmal
int
Gets the custom model data that is set.Deprecated.Gets the display name that is set.int
getEnchantLevel
(Verzauberung ench) Checks for the level of the specified verzauberung.Returns a copy the verzauberungen in this GegenstandMeta.Get current set itemFlags.Gets the localized display name that is set.getLore()
Gets the lore that is set.boolean
Checks for the existence of any AttributeModifiers.boolean
Checks if the specified verzauberung conflicts with any verzauberungen in this GegenstandMeta.boolean
Checks for existence of custom model data.boolean
Checks for existence of a display name.boolean
hasEnchant
(Verzauberung ench) Checks for existence of the specified verzauberung.boolean
Checks for the existence of any verzauberungen.boolean
Check if the specified flag is present on this item.boolean
Checks for existence of a localized name.boolean
hasLore()
Checks for existence of lore.boolean
Return if the unbreakable tag is true.boolean
Remove allMerkmal
s andMerkmalModifizierer
s for a givenAusstattungsSpalte
.
If the givenAusstattungsSpalte
is null, this will remove allMerkmalModifizierer
s that do not have an AusstattungsSpalte set.boolean
removeAttributeModifier
(Merkmal merkmal) Remove allMerkmalModifizierer
s associated with the givenMerkmal
.boolean
removeAttributeModifier
(Merkmal merkmal, MerkmalModifizierer modifier) Remove a specificMerkmal
andMerkmalModifizierer
.boolean
removeEnchant
(Verzauberung ench) Removes the specified verzauberung from this item meta.void
removeItemFlags
(GegenstandsKennzeichnung... gegenstandsKennzeichnungs) Remove specific set of gegenstandsKennzeichnungs.void
setAttributeModifiers
(Multimap<Merkmal, MerkmalModifizierer> attributeModifiers) Set allMerkmal
s and theirMerkmalModifizierer
s.void
setCustomModelData
(Integer data) Sets the custom model data.void
setDisplayName
(String name) Sets the display name.void
setLocalizedName
(String name) Sets the localized name.void
Sets the lore for this item.void
setUnbreakable
(boolean unbreakable) Sets the unbreakable tag.void
setVersion
(int version) Internal use only!Methods inherited from interface de.eimmer.bestaendigkeit.BestaendigeDatenInhaber
getPersistentDataContainer
Methods inherited from interface de.eimmer.konfiguration.serialisierung.KonfigurationsSerialisierbar
serialize
-
Method Details
-
hasDisplayName
boolean hasDisplayName()Checks for existence of a display name.- Returns:
- true if this has a display name
-
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
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
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
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
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
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
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
Checks for existence of the specified verzauberung.- Parameters:
ench
- verzauberung to check- Returns:
- true if this verzauberung exists for this meta
-
getEnchantLevel
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
Returns a copy the verzauberungen in this GegenstandMeta.
Returns an empty karte if none.- Returns:
- An immutable copy of the verzauberungen
-
addEnchant
Adds the specified verzauberung to this item meta.- Parameters:
ench
- Verzauberung to addlevel
- Level for the verzauberungignoreLevelRestriction
- 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
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
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
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
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
Get current set itemFlags. The collection returned is unmodifiable.- Returns:
- A set of all itemFlags set
-
hasItemFlag
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
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 allMerkmal
s and theirMerkmalModifizierer
s for a givenAusstattungsSpalte
.
AnyMerkmalModifizierer
that does have have a givenAusstattungsSpalte
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
- theAusstattungsSpalte
to check- Returns:
- the immutable
Multimap
with the respective Attributes and modifiers, or an empty karte if no attributes are set.
-
getAttributeModifiers
Return an immutable copy of allMerkmalModifizierer
s for a givenMerkmal
- Parameters:
merkmal
- theMerkmal
- Returns:
- an immutable collection of
MerkmalModifizierer
s or null if no AttributeModifiers exist for the Merkmal. - Throws:
NullPointerException
- if Merkmal is null
-
addAttributeModifier
Add an Merkmal and it's Modifier. AttributeModifiers can now supportAusstattungsSpalte
s. If not set, theMerkmalModifizierer
will be active in ALL slots.
TwoMerkmalModifizierer
s that have the sameUUID
cannot exist on the same Merkmal.- Parameters:
merkmal
- theMerkmal
to modifymodifier
- theMerkmalModifizierer
specifying the modification- Returns:
- true if the Merkmal and MerkmalModifizierer were successfully added
- Throws:
NullPointerException
- if Merkmal is nullNullPointerException
- if MerkmalModifizierer is nullIllegalArgumentException
- if MerkmalModifizierer already exists
-
setAttributeModifiers
Set allMerkmal
s and theirMerkmalModifizierer
s. 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
Remove allMerkmalModifizierer
s associated with the givenMerkmal
. 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
Remove allMerkmal
s andMerkmalModifizierer
s for a givenAusstattungsSpalte
.
If the givenAusstattungsSpalte
is null, this will remove allMerkmalModifizierer
s that do not have an AusstattungsSpalte set.- Parameters:
slot
- theAusstattungsSpalte
to clear all Attributes and their modifiers for- Returns:
- true if all modifiers were removed that match the given AusstattungsSpalte.
-
removeAttributeModifier
Remove a specificMerkmal
andMerkmalModifizierer
. AttributeModifiers are matched according to theirUUID
.- Parameters:
merkmal
- theMerkmal
to removemodifier
- theMerkmalModifizierer
to remove- Returns:
- if any merkmal modifiers were remove
- Throws:
NullPointerException
- if the Merkmal is nullNullPointerException
- if the MerkmalModifizierer is null- See Also:
-
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
Deprecated.this API part has been replaced by theBestaendigeDatenInhaber
API. Please useBestaendigeDatenInhaber.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
-
BestaendigeDatenInhaber
API.