Skip to content

Class endstone::PotionMeta

ClassList > endstone > PotionMeta

Represents the metadata for a potion item. More...

  • #include <endstone/inventory/meta/potion_meta.h>

Inherits the following classes: endstone::ItemMeta

Public Functions

Type Name
virtual std::optional< PotionId > getBasePotionType () const = 0
Gets the base potion type of this potion.
virtual bool hasBasePotionType () const = 0
Checks for the presence of a base potion type.
virtual void setBasePotionType (std::optional< PotionId > type) = 0
Sets the base potion type of this potion, or removes it when given std::nullopt .

Public Functions inherited from endstone::ItemMeta

See endstone::ItemMeta

Type Name
virtual bool addEnchant (EnchantmentId id, int level, bool force) = 0
Adds the specified enchantment to this item meta.
virtual std::unique_ptr< ItemMeta > clone () const = 0
Creates a clone of the current metadata.
virtual int getDamage () const = 0
Gets the damage.
virtual std::string getDisplayName () const = 0
Gets the display name that is set.
virtual int getEnchantLevel (EnchantmentId id) const = 0
Checks for the level of the specified enchantment.
virtual std::unordered_map< const Enchantment *, int > getEnchants () const = 0
Returns a copy the enchantments in this ItemMeta .
virtual const core::ItemMetaExtras & getExtras () const = 0
virtual std::vector< std::string > getLore () const = 0
Gets the lore that is set.
virtual int getRepairCost () const = 0
Gets the repair penalty.
virtual bool hasConflictingEnchant (EnchantmentId id) const = 0
Checks if the specified enchantment conflicts with any enchantments in this ItemMeta .
virtual bool hasDamage () const = 0
Checks to see if this item has damage.
virtual bool hasDisplayName () const = 0
Checks for existence of a display name.
virtual bool hasEnchant (EnchantmentId id) const = 0
Checks for existence of the specified enchantment.
virtual bool hasEnchants () const = 0
Checks for the existence of any enchantments.
virtual bool hasLore () const = 0
Checks for existence of lore.
virtual bool hasRepairCost () const = 0
Checks to see if this has a repair penalty.
virtual bool isUnbreakable () const = 0
Return if the unbreakable tag is true.
virtual bool removeEnchant (EnchantmentId id) = 0
Removes the specified enchantment from this item meta.
virtual void removeEnchants () = 0
Removes all enchantments from this item meta.
virtual void setDamage (int damage) = 0
Sets the damage.
virtual void setDisplayName (std::optional< std::string > name) = 0
Sets the display name.
virtual void setLore (std::optional< std::vector< std::string > > lore) = 0
Sets the lore for this item or removes lore when given std::nullopt .
virtual void setRepairCost (int cost) = 0
Sets the repair penalty.
virtual void setUnbreakable (bool unbreakable) = 0
Sets the unbreakable tag.

Public Functions inherited from endstone::Object

See endstone::Object

Type Name
T * as ()
Attempts to cast this object to the given type T.
const T * as () const
Attempts to cast this object to the given type T.
virtual const std::type_info & getClassTypeId () const = 0
bool is () const
Checks if this object is an instance of the given type T (or a subclass of T).
virtual bool isInstanceOf (const std::type_info & target) const = 0
virtual ~Object () = default

Detailed Description

A potion carries a single base potion type, which determines both the effects it applies and the colour it is rendered with.

Public Functions Documentation

function getBasePotionType

Gets the base potion type of this potion.

virtual std::optional< PotionId > endstone::PotionMeta::getBasePotionType () const = 0

Returns:

the base potion type, or std::nullopt if none is set


function hasBasePotionType

Checks for the presence of a base potion type.

virtual bool endstone::PotionMeta::hasBasePotionType () const = 0

Returns:

true if this has a base potion type


function setBasePotionType

Sets the base potion type of this potion, or removes it when given std::nullopt .

virtual void endstone::PotionMeta::setBasePotionType (
    std::optional< PotionId > type
) = 0

Parameters:

  • type the base potion type to set


The documentation for this class was generated from the following file include/endstone/inventory/meta/potion_meta.h