45 int KeyID = Ini.
FindKey(
"Items");
51 for (
int i = 0; i < NumValues; i++)
66 ItemMap::iterator itr =
m_Map.find(a_ItemName);
67 if (itr ==
m_Map.end())
71 return itr->second.first;
84 ItemMap::iterator itr =
m_Map.find(Split[0]);
85 if (itr !=
m_Map.end())
106 if (Split.size() < 2)
126 for (ItemMap::iterator itr =
m_Map.begin(), end =
m_Map.end(); itr != end; ++itr)
128 if ((itr->second.first == a_ItemType) && (itr->second.second == a_ItemDamage))
135 if (a_ItemDamage == 0)
137 for (ItemMap::iterator itr =
m_Map.begin(), end =
m_Map.end(); itr != end; ++itr)
139 if ((itr->second.first == a_ItemType) && (itr->second.second == -1))
148 if (a_ItemDamage == -1)
150 Printf(res,
"%d", a_ItemType);
154 Printf(res,
"%d:%d", a_ItemType, a_ItemDamage);
167 if (Split.size() == 1)
178 ASSERT(!
"Invalid item type");
180 short ItemDamage = -1;
183 ASSERT(!
"Invalid item damage");
185 m_Map[a_Name] = std::make_pair(ItemType, ItemDamage);
220 int res = atoi(a_BlockTypeString.c_str());
221 if ((res != 0) || (a_BlockTypeString.compare(
"0") == 0))
241 if (ItemName.substr(0, 10) ==
"minecraft:")
243 ItemName = ItemName.substr(10);
276 return gsBlockIDMap.
Desolve(a_ItemType, -1);
319 for (
size_t i = 0; i <
ARRAYCOUNT(DimensionMap); i++)
323 return DimensionMap[i].m_Dimension;
328 LOGWARNING(
"Unknown dimension: \"%s\". Setting to Overworld", a_DimensionString.c_str());
350 for (
size_t i = 0; i <
ARRAYCOUNT(DimensionMap); i++)
352 if (DimensionMap[i].m_Dimension == a_Dimension)
354 return DimensionMap[i].m_String;
359 LOGWARNING(
"Unknown dimension: \"%i\". Setting to Overworld", static_cast<int>(a_Dimension));
371 switch (a_DamageType)
373 case dtAdmin:
return "dtAdmin";
460 for (
size_t i = 0; i <
ARRAYCOUNT(DamageTypeMap); i++)
464 return DamageTypeMap[i].m_DamageType;
eDimension
Dimension of a world.
static bool m_bHasRunInit
int BlockStringToType(const AString &a_BlockTypeString)
Translates a blocktype string into blocktype.
static cBlockIDMap gsBlockIDMap
bool StringToInteger(const AString &a_str, T &a_Num)
Parses any integer type.
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...
int Resolve(const AString &a_ItemName)
int GetNumValues(const AString &keyname) const
AString ItemToString(const cItem &a_Item)
Translates a full item into a string.
eDamageType StringToDamageType(const AString &a_DamageTypeString)
Translates a damage type string to damage type.
AString Desolve(short a_ItemType, short a_ItemDamage)
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 ...
std::vector< AString > AStringVector
AString DamageTypeToString(eDamageType a_DamageType)
Translates damage type constant to a string representation (built-in)
eDamageType
Damage type, used in the TakeDamageInfo structure and related functions.
int FindKey(const AString &keyname) const
Returns index of specified key, or noID if not found.
void AddToMap(const AString &a_Name, const AString &a_Value)
eDimension StringToDimension(const AString &a_DimensionString)
Translates a dimension string to dimension enum.
int NoCaseCompare(const AString &s1, const AString &s2)
Case-insensitive string comparison.
AStringVector StringSplitAndTrim(const AString &str, const AString &delim)
Split the string at any of the listed delimiters and trim each value.
AString & Printf(AString &str, const char *format, fmt::ArgList args)
Output the formatted text into the string.
AString DimensionToString(eDimension a_Dimension)
Translates a dimension enum to dimension string.
void LOGWARNING(const char *a_Format, fmt::ArgList a_ArgList)
AString GetValueName(const AString &keyname, const int valueID) const
bool ResolveItem(const AString &a_ItemName, cItem &a_Item)
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.
AString ItemToFullString(const cItem &a_Item)
Translates a full item into a fully-specified string (including meta and count).
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.
bool operator()(const AString &a_Item1, const AString &a_Item2) const
bool StringToItem(const AString &a_ItemTypeString, cItem &a_Item)
Translates an itemtype string into an item.
#define ARRAYCOUNT(X)
Evaluates to the number of elements in an array (compile-time!)
AString ItemTypeToString(short a_ItemType)
Translates itemtype into a string.
#define UNREACHABLE(x)
Use to mark code that should be impossible to reach.
std::map< AString, std::pair< short, short >, Comparator > ItemMap
AString GetValueSet(const AString &keyname, const AString &valuename, const AString &defValue="") override
Gets the value; if not found, write the default to the repository.