AString ItemTypeToString(short a_ItemType) { if (!gsBlockIDMap.m_bHasRunInit) { gsBlockIDMap.init(); } return gsBlockIDMap.Desolve(a_ItemType, -1); }
AString ItemToString(const cItem & a_Item) { if (!gsBlockIDMap.m_bHasRunInit) { gsBlockIDMap.init(); } return gsBlockIDMap.Desolve(a_Item.m_ItemType, a_Item.m_ItemDamage); }
bool StringToItem(const AString & a_ItemTypeString, cItem & a_Item) { AString ItemName = TrimString(a_ItemTypeString); if (ItemName.substr(0, 10) == "minecraft:") { ItemName = ItemName.substr(10); } if (!gsBlockIDMap.m_bHasRunInit) { gsBlockIDMap.init(); } return gsBlockIDMap.ResolveItem(ItemName, a_Item); }
int BlockStringToType(const AString & a_BlockTypeString) { int res = atoi(a_BlockTypeString.c_str()); if ((res != 0) || (a_BlockTypeString.compare("0") == 0)) { // It was a valid number, return that return res; } if (!gsBlockIDMap.m_bHasRunInit) { gsBlockIDMap.init(); } return gsBlockIDMap.Resolve(TrimString(a_BlockTypeString)); }