summaryrefslogtreecommitdiffstats
path: root/src/Item.cpp
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2017-08-18 12:29:54 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2017-08-18 12:29:54 +0200
commitb8dda388e0cf300f573d411dc670099e56c2e3c3 (patch)
tree6c3f40beb7a652f9c5afa560954e68a53db54401 /src/Item.cpp
parentChanged type of FastRandom in monster drop calculation. (#3920) (diff)
downloadcuberite-b8dda388e0cf300f573d411dc670099e56c2e3c3.tar
cuberite-b8dda388e0cf300f573d411dc670099e56c2e3c3.tar.gz
cuberite-b8dda388e0cf300f573d411dc670099e56c2e3c3.tar.bz2
cuberite-b8dda388e0cf300f573d411dc670099e56c2e3c3.tar.lz
cuberite-b8dda388e0cf300f573d411dc670099e56c2e3c3.tar.xz
cuberite-b8dda388e0cf300f573d411dc670099e56c2e3c3.tar.zst
cuberite-b8dda388e0cf300f573d411dc670099e56c2e3c3.zip
Diffstat (limited to 'src/Item.cpp')
-rw-r--r--src/Item.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Item.cpp b/src/Item.cpp
index 3d9efb3b3..995ff59dc 100644
--- a/src/Item.cpp
+++ b/src/Item.cpp
@@ -158,7 +158,12 @@ void cItem::GetJson(Json::Value & a_OutValue) const
}
if (!IsLoreEmpty())
{
- a_OutValue["Lore"] = m_Lore;
+ auto & LoreArray = (a_OutValue["Lore"] = Json::Value(Json::arrayValue));
+
+ for (const auto & Line : m_LoreTable)
+ {
+ LoreArray.append(Line);
+ }
}
if (m_ItemColor.IsValid())
@@ -196,7 +201,11 @@ void cItem::FromJson(const Json::Value & a_Value)
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();
+ auto Lore = a_Value.get("Lore", Json::arrayValue);
+ for (auto & Line : Lore)
+ {
+ m_LoreTable.push_back(Line.asString());
+ }
int red = a_Value.get("Color_Red", -1).asInt();
int green = a_Value.get("Color_Green", -1).asInt();