summaryrefslogtreecommitdiffstats
path: root/src/Protocol
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/Protocol
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/Protocol')
-rw-r--r--src/Protocol/Protocol_1_8.cpp16
-rw-r--r--src/Protocol/Protocol_1_9.cpp17
2 files changed, 7 insertions, 26 deletions
diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp
index f578e0e65..873ed2902 100644
--- a/src/Protocol/Protocol_1_8.cpp
+++ b/src/Protocol/Protocol_1_8.cpp
@@ -2883,14 +2883,10 @@ void cProtocol_1_8_0::ParseItemMetadata(cItem & a_Item, const AString & a_Metada
}
else if ((NBT.GetType(displaytag) == TAG_List) && (NBT.GetName(displaytag) == "Lore")) // Lore tag
{
- AString Lore;
-
for (int loretag = NBT.GetFirstChild(displaytag); loretag >= 0; loretag = NBT.GetNextSibling(loretag)) // Loop through array of strings
{
- AppendPrintf(Lore, "%s`", NBT.GetString(loretag).c_str()); // Append the lore with a grave accent / backtick, used internally by MCS to display a new line in the client; don't forget to c_str ;)
+ a_Item.m_LoreTable.push_back(NBT.GetString(loretag));
}
-
- a_Item.m_Lore = Lore;
}
else if ((NBT.GetType(displaytag) == TAG_Int) && (NBT.GetName(displaytag) == "color"))
{
@@ -3079,15 +3075,9 @@ void cProtocol_1_8_0::WriteItem(cPacketizer & a_Pkt, const cItem & a_Item)
{
Writer.BeginList("Lore", TAG_String);
- AStringVector Decls = StringSplit(a_Item.m_Lore, "`");
- for (AStringVector::const_iterator itr = Decls.begin(), end = Decls.end(); itr != end; ++itr)
+ for (const auto & Line : a_Item.m_LoreTable)
{
- if (itr->empty())
- {
- // The decl is empty (two `s), ignore
- continue;
- }
- Writer.AddString("", itr->c_str());
+ Writer.AddString("", Line);
}
Writer.EndList();
diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp
index 3e0171b24..56f41ec51 100644
--- a/src/Protocol/Protocol_1_9.cpp
+++ b/src/Protocol/Protocol_1_9.cpp
@@ -2999,14 +2999,11 @@ void cProtocol_1_9_0::ParseItemMetadata(cItem & a_Item, const AString & a_Metada
}
else if ((NBT.GetType(displaytag) == TAG_List) && (NBT.GetName(displaytag) == "Lore")) // Lore tag
{
- AString Lore;
-
+ a_Item.m_LoreTable.clear();
for (int loretag = NBT.GetFirstChild(displaytag); loretag >= 0; loretag = NBT.GetNextSibling(loretag)) // Loop through array of strings
{
- AppendPrintf(Lore, "%s`", NBT.GetString(loretag).c_str()); // Append the lore with a grave accent / backtick, used internally by MCS to display a new line in the client; don't forget to c_str ;)
+ a_Item.m_LoreTable.push_back(NBT.GetString(loretag));
}
-
- a_Item.m_Lore = Lore;
}
else if ((NBT.GetType(displaytag) == TAG_Int) && (NBT.GetName(displaytag) == "color"))
{
@@ -3342,15 +3339,9 @@ void cProtocol_1_9_0::WriteItem(cPacketizer & a_Pkt, const cItem & a_Item)
{
Writer.BeginList("Lore", TAG_String);
- AStringVector Decls = StringSplit(a_Item.m_Lore, "`");
- for (AStringVector::const_iterator itr = Decls.begin(), end = Decls.end(); itr != end; ++itr)
+ for (const auto & Line : a_Item.m_LoreTable)
{
- if (itr->empty())
- {
- // The decl is empty (two `s), ignore
- continue;
- }
- Writer.AddString("", itr->c_str());
+ Writer.AddString("", Line);
}
Writer.EndList();