endstone::ItemFactory
Functions:
| Name | Description |
|---|---|
asMetaFor | Returns an appropriate item meta for the specified item type. |
equals | This method is used to compare two ItemMeta objects. |
getItemMeta | This creates a new item meta for the item type. |
isApplicable | This method checks the item meta to confirm that it is applicable (no data lost if applied) to the specified ItemStack . |
asMetaFor
std::unique_ptr<ItemMeta> asMetaFor(const ItemMeta *meta,
const std::string &type) constReturns an appropriate item meta for the specified item type.
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:
metathe meta to converttypethe item type to convert the meta for
Returns:
An appropriate item meta for the specified item type.
equals
bool equals(const ItemMeta *meta1, const ItemMeta *meta2) constThis method is used to compare two ItemMeta objects.
Parameters:
meta1First meta to compare, and may be null to indicate no datameta2Second 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
getItemMeta
std::unique_ptr<ItemMeta> getItemMeta(const std::string &type) constThis creates a new item meta for the item type.
Parameters:
typeThe 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
isApplicable
bool isApplicable(const ItemMeta *meta, const std::string &type) constThis method checks the item meta to confirm that it is applicable (no data lost if applied) to the specified ItemStack .
Parameters:
metaMeta to checktypeThe item type that meta will be applied to
Returns:
true if the meta can be applied without losing data, false otherwise