Class endstone::MapMeta¶
ClassList > endstone > MapMeta
Represents the metadata for a map item.
#include <endstone/inventory/meta/map_meta.h>
Inherits the following classes: endstone::ItemMeta
Public Types inherited from endstone::ItemMeta¶
Type | Name |
---|---|
enum | Type |
Public Static Attributes¶
Type | Name |
---|---|
constexpr auto | TYPE = Type::Map |
Public Functions¶
Type | Name |
---|---|
MapMeta (const ItemMeta * meta) |
|
virtual std::unique_ptr< ItemMeta > | clone () override const Creates a clone of the current metadata. |
std::int64_t | getMapId () const Gets the map ID that is set. This is used to determine what map is displayed. |
MapView * | getMapView () const Gets the map view associated with this map item. |
virtual Type | getType () override const Gets the type of this item meta. |
bool | hasMapId () const Checks for existence of a map ID number. |
bool | hasMapView () const Checks for existence of an associated map. |
virtual bool | isEmpty () override const Checks if the item metadata is empty. |
void | setMapId (std::int64_t id) Sets the map ID. This is used to determine what map is displayed. |
void | setMapView (const MapView * map) Sets the associated map. This is used to determine what map is displayed. |
Public Functions inherited from endstone::ItemMeta¶
Type | Name |
---|---|
ItemMeta (const ItemMeta * meta) |
|
bool | addEnchant (const std::string & id, int level, bool force=false) Adds the specified enchantment to this item meta. |
T * | as () |
const T * | as () const |
virtual std::unique_ptr< ItemMeta > | clone () const Creates a clone of the current metadata. |
int | getDamage () const Gets the damage. |
std::string | getDisplayName () const Gets the display name that is set. |
int | getEnchantLevel (const std::string & id) const Checks for the level of the specified enchantment. |
std::unordered_map< std::string, int > | getEnchants () const Returns a copy the enchantments in this ItemMeta . |
std::vector< std::string > | getLore () const Gets the lore that is set. |
int | getRepairCost () const Gets the repair penalty. |
virtual Type | getType () const Gets the type of this item meta. |
bool | hasDamage () const Checks to see if this item has damage. |
bool | hasDisplayName () const Checks for existence of a display name. |
bool | hasEnchant (const std::string & id) const Checks for existence of the specified enchantment. |
bool | hasEnchants () const Checks for the existence of any enchantments. |
bool | hasLore () const Checks for existence of lore. |
bool | hasRepairCost () const Checks to see if this has a repair penalty. |
virtual bool | isEmpty () const Checks if the item metadata is empty. |
bool | isUnbreakable () const Return if the unbreakable tag is true. An unbreakable item will not lose durability. |
bool | removeEnchant (const std::string & id) Removes the specified enchantment from this item meta. |
void | removeEnchants () Removes all enchantments from this item meta. |
void | setDamage (int damage) Sets the damage. |
void | setDisplayName (std::optional< std::string > name) Sets the display name. |
void | setLore (std::optional< std::vector< std::string > > lore) Sets the lore for this item or removes lore when given std::nullopt. |
void | setRepairCost (int cost) Sets the repair penalty. |
void | setUnbreakable (bool unbreakable) Sets the unbreakable tag. An unbreakable item will not lose durability. |
virtual | ~ItemMeta () = default |
Public Static Attributes Documentation¶
variable TYPE¶
Public Functions Documentation¶
function MapMeta¶
function clone¶
Creates a clone of the current metadata.
Returns:
A copy of the metadata containing the same state as the original.
Implements endstone::ItemMeta::clone
function getMapId¶
Gets the map ID that is set. This is used to determine what map is displayed.
Returns:
the map ID that is set
function getMapView¶
Gets the map view associated with this map item.
Note:
Plugins should check that hasMapView() returns true before calling this method.
Returns:
the map view, or nullptr if the item hasMapView(), but this map does not exist on the server
function getType¶
Gets the type of this item meta.
Returns:
type of this item meta
Implements endstone::ItemMeta::getType
function hasMapId¶
Checks for existence of a map ID number.
Returns:
true if this has a map ID number.
function hasMapView¶
Checks for existence of an associated map.
Returns:
true if this item has an associated map
function isEmpty¶
Checks if the item metadata is empty.
Returns:
true if the metadata is empty, false otherwise.
Implements endstone::ItemMeta::isEmpty
function setMapId¶
Sets the map ID. This is used to determine what map is displayed.
Parameters:
id
the map id to set
function setMapView¶
Sets the associated map. This is used to determine what map is displayed.
Parameters:
map
the map to set
The documentation for this class was generated from the following file include/endstone/inventory/meta/map_meta.h