diff options
Diffstat (limited to '')
-rw-r--r-- | src/WorldStorage/NBTChunkSerializer.cpp | 10 | ||||
-rw-r--r-- | src/WorldStorage/WSSAnvil.cpp | 7 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp index ecda9b8fd..e435a1b1f 100644 --- a/src/WorldStorage/NBTChunkSerializer.cpp +++ b/src/WorldStorage/NBTChunkSerializer.cpp @@ -570,8 +570,14 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster) case cMonster::mtWolf: { const cWolf & Wolf = *((cWolf *)a_Monster); - m_Writer.AddString("Owner", Wolf.GetOwnerName()); - m_Writer.AddString("OwnerUUID", Wolf.GetOwnerUUID()); + if (!Wolf.GetOwnerName().empty()) + { + m_Writer.AddString("Owner", Wolf.GetOwnerName()); + } + if (!Wolf.GetOwnerUUID().empty()) + { + m_Writer.AddString("OwnerUUID", Wolf.GetOwnerUUID()); + } m_Writer.AddByte("Sitting", Wolf.IsSitting() ? 1 : 0); m_Writer.AddByte("Angry", Wolf.IsAngry() ? 1 : 0); m_Writer.AddInt("CollarColor", Wolf.GetCollarColor()); diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index 434f1e21f..a9c9ae4b5 100644 --- a/src/WorldStorage/WSSAnvil.cpp +++ b/src/WorldStorage/WSSAnvil.cpp @@ -2495,7 +2495,7 @@ void cWSSAnvil::LoadWolfOwner(cWolf & a_Wolf, const cParsedNBT & a_NBT, int a_Ta int OwnerUUIDIdx = a_NBT.FindChildByName(a_TagIdx, "OwnerUUID"); if (OwnerUUIDIdx > 0) { - OwnerUUID = cMojangAPI::MakeUUIDShort(a_NBT.GetString(OwnerUUIDIdx)); + OwnerUUID = a_NBT.GetString(OwnerUUIDIdx); } int OwnerIdx = a_NBT.FindChildByName(a_TagIdx, "Owner"); if (OwnerIdx > 0) @@ -2520,6 +2520,11 @@ void cWSSAnvil::LoadWolfOwner(cWolf & a_Wolf, const cParsedNBT & a_NBT, int a_Ta return; } } + else + { + // Normalize the UUID: + OwnerUUID = cMojangAPI::MakeUUIDShort(OwnerUUID); + } // Convert UUID to name, if needed: if (OwnerName.empty()) |