示例#1
0
AString ItemTypeToString(short a_ItemType)
{
	if (!gsBlockIDMap.m_bHasRunInit)
	{
		gsBlockIDMap.init();
	}
	return gsBlockIDMap.Desolve(a_ItemType, -1);
}
示例#2
0
AString ItemToString(const cItem & a_Item)
{
	if (!gsBlockIDMap.m_bHasRunInit)
	{
		gsBlockIDMap.init();
	}
	return gsBlockIDMap.Desolve(a_Item.m_ItemType, a_Item.m_ItemDamage);
}
示例#3
0
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);
}
示例#4
0
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));
}