summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage
diff options
context:
space:
mode:
authormjagdis <mjagdis@eris-associates.co.uk>2024-06-30 20:09:42 +0200
committerGitHub <noreply@github.com>2024-06-30 20:09:42 +0200
commitb7de59de89994f026336e690e9ed7449f89836b8 (patch)
tree4aad3d70c8e76a8a2b20a3eb88471a1d609134fd /src/WorldStorage
parentSend metadata for item frames (#5568) (diff)
downloadcuberite-b7de59de89994f026336e690e9ed7449f89836b8.tar
cuberite-b7de59de89994f026336e690e9ed7449f89836b8.tar.gz
cuberite-b7de59de89994f026336e690e9ed7449f89836b8.tar.bz2
cuberite-b7de59de89994f026336e690e9ed7449f89836b8.tar.lz
cuberite-b7de59de89994f026336e690e9ed7449f89836b8.tar.xz
cuberite-b7de59de89994f026336e690e9ed7449f89836b8.tar.zst
cuberite-b7de59de89994f026336e690e9ed7449f89836b8.zip
Diffstat (limited to 'src/WorldStorage')
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp4
-rw-r--r--src/WorldStorage/WSSAnvil.cpp14
2 files changed, 15 insertions, 3 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index fb6459c88..c61e6d185 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -376,6 +376,10 @@ public:
mWriter.BeginCompound("");
AddBasicTileEntity(a_Entity,"Banner");
mWriter.AddInt("Base", static_cast<int>(a_Entity->GetBaseColor()));
+ if (!a_Entity->GetCustomName().empty())
+ {
+ mWriter.AddString("CustomName", a_Entity->GetCustomName());
+ }
mWriter.EndCompound();
}
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index dec05f351..5a5a94d4e 100644
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -890,15 +890,23 @@ OwnedBlockEntity cWSSAnvil::LoadBannerFromNBT(const cParsedNBT & a_NBT, int a_Ta
return nullptr;
}
+ unsigned char Color = 15;
+ AString CustomName;
+
// Reads base color from NBT
int CurrentLine = a_NBT.FindChildByName(a_TagIdx, "Base");
if (CurrentLine >= 0)
{
- const auto Color = static_cast<unsigned char>(a_NBT.GetInt(CurrentLine));
- return std::make_unique<cBannerEntity>(a_BlockType, a_BlockMeta, a_Pos, m_World, Color);
+ Color = static_cast<unsigned char>(a_NBT.GetInt(CurrentLine));
}
- return nullptr;
+ CurrentLine = a_NBT.FindChildByName(a_TagIdx, "CustomName");
+ if ((CurrentLine >= 0) && (a_NBT.GetType(CurrentLine) == TAG_String))
+ {
+ CustomName = a_NBT.GetString(CurrentLine);
+ }
+
+ return std::make_unique<cBannerEntity>(a_BlockType, a_BlockMeta, a_Pos, m_World, Color, CustomName);
}