Class endstone::ItemFactory¶
ClassList > endstone > ItemFactory
Public Functions¶
Type | Name |
---|---|
virtual std::unique_ptr< ItemMeta > | asMetaFor (const ItemMeta * meta, std::string_view type) const = 0 Returns an appropriate item meta for the specified item type. |
virtual bool | equals (const ItemMeta * meta1, const ItemMeta * meta2) const = 0 This method is used to compare two ItemMeta objects. |
virtual std::unique_ptr< ItemMeta > | getItemMeta (std::string_view type) const = 0 This creates a new item meta for the item type. |
virtual bool | isApplicable (const ItemMeta * meta, std::string_view type) const = 0 This method checks the item meta to confirm that it is applicable (no data lost if applied) to the specified ItemStack . |
virtual | ~ItemFactory () = default |
Public Functions Documentation¶
function asMetaFor¶
Returns an appropriate item meta for the specified item type.
virtual std::unique_ptr< ItemMeta > endstone::ItemFactory::asMetaFor (
const ItemMeta * meta,
std::string_view type
) const = 0
The item meta returned will always be a valid meta for a given ItemStack of the specified item type. It may be a more or less specific meta, and could also be the same meta or meta type as the parameter. The item meta returned will also always be the most appropriate meta.
Parameters:
meta
the meta to converttype
the item type to convert the meta for
Returns:
An appropriate item meta for the specified item type.
function equals¶
This method is used to compare two ItemMeta objects.
virtual bool endstone::ItemFactory::equals (
const ItemMeta * meta1,
const ItemMeta * meta2
) const = 0
Parameters:
meta1
First meta to compare, and may be null to indicate no datameta2
Second meta to compare, and may be null to indicate no data
Returns:
false if one of the meta has data the other does not, otherwise true
function getItemMeta¶
This creates a new item meta for the item type.
virtual std::unique_ptr< ItemMeta > endstone::ItemFactory::getItemMeta (
std::string_view type
) const = 0
Parameters:
type
The item type to consider as base for the meta
Returns:
a new ItemMeta that could be applied to an item stack of the specified item type
function isApplicable¶
This method checks the item meta to confirm that it is applicable (no data lost if applied) to the specified ItemStack .
virtual bool endstone::ItemFactory::isApplicable (
const ItemMeta * meta,
std::string_view type
) const = 0
Parameters:
meta
Meta to checktype
The item type that meta will be applied to
Returns:
true if the meta can be applied without losing data, false otherwise
function ~ItemFactory¶
The documentation for this class was generated from the following file include/endstone/inventory/item_factory.h