summaryrefslogtreecommitdiffstats
path: root/src/Item.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-01-15 23:38:03 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-01-15 23:38:03 +0100
commitfcafd5a2e0f87fcc79e0a723241604aeca50d017 (patch)
tree97c3f06c4a7987cede55b61aaa59a56f3321920e /src/Item.cpp
parentImplemented Ctrl-Q drop stack (diff)
downloadcuberite-fcafd5a2e0f87fcc79e0a723241604aeca50d017.tar
cuberite-fcafd5a2e0f87fcc79e0a723241604aeca50d017.tar.gz
cuberite-fcafd5a2e0f87fcc79e0a723241604aeca50d017.tar.bz2
cuberite-fcafd5a2e0f87fcc79e0a723241604aeca50d017.tar.lz
cuberite-fcafd5a2e0f87fcc79e0a723241604aeca50d017.tar.xz
cuberite-fcafd5a2e0f87fcc79e0a723241604aeca50d017.tar.zst
cuberite-fcafd5a2e0f87fcc79e0a723241604aeca50d017.zip
Diffstat (limited to 'src/Item.cpp')
-rw-r--r--src/Item.cpp32
1 files changed, 10 insertions, 22 deletions
diff --git a/src/Item.cpp b/src/Item.cpp
index a44515019..9170006b6 100644
--- a/src/Item.cpp
+++ b/src/Item.cpp
@@ -91,28 +91,6 @@ bool cItem::DamageItem(short a_Amount)
-bool cItem::IsStackableWith(const cItem & a_OtherStack) const
-{
- if (a_OtherStack.m_ItemType != m_ItemType)
- {
- return false;
- }
- if (a_OtherStack.m_ItemDamage != m_ItemDamage)
- {
- return false;
- }
- if (a_OtherStack.m_Enchantments != m_Enchantments)
- {
- return false;
- }
-
- return true;
-}
-
-
-
-
-
bool cItem::IsFullStack(void) const
{
return (m_ItemCount >= ItemHandler(m_ItemType)->GetMaxStackSize());
@@ -153,6 +131,14 @@ void cItem::GetJson(Json::Value & a_OutValue) const
{
a_OutValue["ench"] = Enchantments;
}
+ if (!IsCustomNameEmpty())
+ {
+ a_OutValue["Name"] = m_CustomName;
+ }
+ if (!IsLoreEmpty())
+ {
+ a_OutValue["Lore"] = m_Lore;
+ }
}
}
@@ -169,6 +155,8 @@ void cItem::FromJson(const Json::Value & a_Value)
m_ItemDamage = (short)a_Value.get("Health", -1 ).asInt();
m_Enchantments.Clear();
m_Enchantments.AddFromString(a_Value.get("ench", "").asString());
+ m_CustomName = a_Value.get("Name", "").asString();
+ m_Lore = a_Value.get("Lore", "").asString();
}
}