36 int KeyID = Ini.
FindKey(
"Items");
42 for (
int i = 0; i < NumValues; i++)
57 ItemMap::iterator itr =
m_Map.find(a_ItemName);
58 if (itr ==
m_Map.end())
62 return itr->second.first;
75 ItemMap::iterator itr =
m_Map.find(Split[0]);
76 if (itr !=
m_Map.end())
117 for (ItemMap::iterator itr =
m_Map.begin(), end =
m_Map.end(); itr != end; ++itr)
119 if ((itr->second.first == a_ItemType) && (itr->second.second == a_ItemDamage))
126 if (a_ItemDamage == 0)
128 for (ItemMap::iterator itr =
m_Map.begin(), end =
m_Map.end(); itr != end; ++itr)
130 if ((itr->second.first == a_ItemType) && (itr->second.second == -1))
139 if (a_ItemDamage == -1)
141 res = fmt::format(FMT_STRING(
"{}"), a_ItemType);
145 res = fmt::format(FMT_STRING(
"{}:{}"), a_ItemType, a_ItemDamage);
158 if (Split.size() == 1)
169 ASSERT(!
"Invalid item type");
171 short ItemDamage = -1;
174 ASSERT(!
"Invalid item damage");
176 m_Map[a_Name] = std::make_pair(ItemType, ItemDamage);
214 int res = atoi(a_BlockTypeString.c_str());
215 if ((res != 0) || (a_BlockTypeString.compare(
"0") == 0))
231 if (ItemName.substr(0, 10) ==
"minecraft:")
233 ItemName = ItemName.substr(10);
int BlockStringToType(const AString &a_BlockTypeString)
Translates a blocktype string into blocktype.
static cBlockIDMap & GetBlockIDMap()
AString ItemToString(const cItem &a_Item)
Translates a full item into a string.
cItem GetIniItemSet(cIniFile &a_IniFile, const char *a_Section, const char *a_Key, const char *a_Default)
Returns a cItem representing the item described in an IniFile's value; if the value doesn't exist,...
bool StringToItem(const AString &a_ItemTypeString, cItem &a_Item)
Translates an itemtype string into an item.
AString ItemToFullString(const cItem &a_Item)
Translates a full item into a fully-specified string (including meta and count).
AString ItemTypeToString(short a_ItemType)
Translates itemtype into a string.
AStringVector StringSplitAndTrim(const AString &str, const AString &delim)
Split the string at any of the listed delimiters and trim each value.
AString TrimString(const AString &str)
Trims whitespace at both ends of the string.
AStringVector StringSplit(const AString &str, const AString &delim)
Split the string at any of the listed delimiters.
int NoCaseCompare(const AString &s1, const AString &s2)
Case-insensitive string comparison.
std::vector< AString > AStringVector
bool StringToInteger(const AString &a_str, T &a_Num)
Parses any integer type.
void AddToMap(const AString &a_Name, const AString &a_Value)
AString Desolve(short a_ItemType, short a_ItemDamage)
std::map< AString, std::pair< short, short >, Comparator > ItemMap
int Resolve(const AString &a_ItemName)
bool ResolveItem(const AString &a_ItemName, cItem &a_Item)
bool operator()(const AString &a_Item1, const AString &a_Item2) const
int FindKey(const AString &keyname) const
Returns index of specified key, or noID if not found.
AString GetValue(const AString &keyname, const AString &valuename, const AString &defValue="") const override
Get the value at the specified key and value, returns defValue on failure.
int GetNumValues(const AString &keyname) const
bool ReadFile(const AString &a_FileName, bool a_AllowExampleRedirect=true)
Reads the contents of the specified ini file If the file doesn't exist and a_AllowExampleRedirect is ...
AString GetValueName(const AString &keyname, const int valueID) const
AString GetValueSet(const AString &keyname, const AString &valuename, const AString &defValue="") override
Gets the value; if not found, write the default to the repository.
void Empty(void)
Empties the item and frees up any dynamic storage used by the internals.