summaryrefslogtreecommitdiffstats
path: root/source/Enchantments.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-02 23:44:24 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-02 23:44:24 +0200
commitd2b3011c05890652b0aa09f6e128004056a98258 (patch)
tree8297f8386096a624f7762f6bb36d7170742952d5 /source/Enchantments.h
parentEnchantments are now stored in Anvil world and in player inventory (diff)
downloadcuberite-d2b3011c05890652b0aa09f6e128004056a98258.tar
cuberite-d2b3011c05890652b0aa09f6e128004056a98258.tar.gz
cuberite-d2b3011c05890652b0aa09f6e128004056a98258.tar.bz2
cuberite-d2b3011c05890652b0aa09f6e128004056a98258.tar.lz
cuberite-d2b3011c05890652b0aa09f6e128004056a98258.tar.xz
cuberite-d2b3011c05890652b0aa09f6e128004056a98258.tar.zst
cuberite-d2b3011c05890652b0aa09f6e128004056a98258.zip
Diffstat (limited to 'source/Enchantments.h')
-rw-r--r--source/Enchantments.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/Enchantments.h b/source/Enchantments.h
index 96ebc1880..002626413 100644
--- a/source/Enchantments.h
+++ b/source/Enchantments.h
@@ -26,9 +26,9 @@ class cParsedNBT;
/** Class that stores item enchantments or stored-enchantments
The enchantments may be serialized to a stringspec and read back from such stringspec.
The format for the stringspec is "id=lvl;id=lvl;id=lvl...", with an optional semicolon at the end,
-mapping each enchantment's id onto its level.
+mapping each enchantment's id onto its level. ID may be either a number or the enchantment name.
Level value of 0 means no such enchantment, and it will not be stored in the m_Enchantments.
-Serialization will never put zero-level enchantments into the stringspec.
+Serialization will never put zero-level enchantments into the stringspec and will always use numeric IDs.
*/
class cEnchantments
{
@@ -84,6 +84,9 @@ public:
/// Returns true if there are no enchantments
bool IsEmpty(void) const;
+ /// Converts enchantment name to the numeric representation; returns -1 if enchantment name not found; case insensitive
+ static int StringToEnchantmentID(const AString & a_EnchantmentName);
+
// tolua_end
/// Writes the enchantments into the specified NBT writer; begins with the LIST tag of the specified name ("ench" or "StoredEnchantments")