Skip to Content
⚠ Under Construction
ReferenceC++ APIItemFactory

endstone::ItemFactory

Functions:

NameDescription
asMetaForReturns an appropriate item meta for the specified item type.
equalsThis method is used to compare two ItemMeta objects.
getItemMetaThis creates a new item meta for the item type.
isApplicableThis 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) const

Returns 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:

  • meta the meta to convert
  • type the 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) const

This method is used to compare two ItemMeta objects.

Parameters:

  • meta1 First meta to compare, and may be null to indicate no data
  • meta2 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

getItemMeta

std::unique_ptr<ItemMeta> getItemMeta(const std::string &type) const

This creates a new item meta for the item type.

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

isApplicable

bool isApplicable(const ItemMeta *meta, const std::string &type) const

This method checks the item meta to confirm that it is applicable (no data lost if applied) to the specified ItemStack .

Parameters:

  • meta Meta to check
  • type The item type that meta will be applied to

Returns:

true if the meta can be applied without losing data, false otherwise

Last updated on