summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/Enchantments.cpp9
-rw-r--r--source/Enchantments.h3
-rw-r--r--source/Item.cpp9
3 files changed, 20 insertions, 1 deletions
diff --git a/source/Enchantments.cpp b/source/Enchantments.cpp
index 57079b734..08a24d8f3 100644
--- a/source/Enchantments.cpp
+++ b/source/Enchantments.cpp
@@ -203,6 +203,15 @@ bool cEnchantments::operator ==(const cEnchantments & a_Other) const
+bool cEnchantments::operator !=(const cEnchantments & a_Other) const
+{
+ return m_Enchantments != a_Other.m_Enchantments;
+}
+
+
+
+
+
void cEnchantments::WriteToNBTCompound(cFastNBTWriter & a_Writer, const AString & a_ListTagName) const
{
// Write the enchantments into the specified NBT writer
diff --git a/source/Enchantments.h b/source/Enchantments.h
index 0b720c4e1..30c2fe7b7 100644
--- a/source/Enchantments.h
+++ b/source/Enchantments.h
@@ -90,6 +90,9 @@ public:
/// Returns true if a_Other contains exactly the same enchantments and levels
bool operator ==(const cEnchantments & a_Other) const;
+ /// Returns true if a_Other doesn't contain exactly the same enchantments and levels
+ bool operator !=(const cEnchantments & a_Other) const;
+
// tolua_end
/// Writes the enchantments into the specified NBT writer; begins with the LIST tag of the specified name ("ench" or "StoredEnchantments")
diff --git a/source/Item.cpp b/source/Item.cpp
index 569d04980..fce4a431b 100644
--- a/source/Item.cpp
+++ b/source/Item.cpp
@@ -81,8 +81,15 @@ bool cItem::IsStackableWith(const cItem & a_OtherStack) const
{
return false;
}
+ if (a_OtherStack.m_ItemDamage != m_ItemDamage)
+ {
+ return false;
+ }
+ if (a_OtherStack.m_Enchantments != m_Enchantments)
+ {
+ return false;
+ }
- // TODO: match enchantments etc.
return true;
}