summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage
diff options
context:
space:
mode:
authorFranz Reiter <franzi.moos@googlemail.com>2014-09-23 15:54:07 +0200
committerFranz Reiter <franzi.moos@googlemail.com>2014-09-23 15:54:07 +0200
commit33f8091d5f550a91b1fbe24f07a397aa5a336093 (patch)
tree4fe1be83dd4212e010fed749cd444c4deecc64e6 /src/WorldStorage
parentQtBiomeVisualiser: Fixed confusion about Globals.h. (diff)
parentFixed SQLiteCpp downgrade (diff)
downloadcuberite-33f8091d5f550a91b1fbe24f07a397aa5a336093.tar
cuberite-33f8091d5f550a91b1fbe24f07a397aa5a336093.tar.gz
cuberite-33f8091d5f550a91b1fbe24f07a397aa5a336093.tar.bz2
cuberite-33f8091d5f550a91b1fbe24f07a397aa5a336093.tar.lz
cuberite-33f8091d5f550a91b1fbe24f07a397aa5a336093.tar.xz
cuberite-33f8091d5f550a91b1fbe24f07a397aa5a336093.tar.zst
cuberite-33f8091d5f550a91b1fbe24f07a397aa5a336093.zip
Diffstat (limited to '')
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp2
-rw-r--r--src/WorldStorage/WSSAnvil.cpp13
2 files changed, 15 insertions, 0 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index 68e541eba..1962d42ff 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -504,6 +504,8 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
m_Writer.AddFloat("", a_Monster->GetDropChanceBoots());
m_Writer.EndList();
m_Writer.AddByte("CanPickUpLoot", (char)a_Monster->CanPickUpLoot());
+ m_Writer.AddString("CustomName", a_Monster->GetCustomName());
+ m_Writer.AddByte("CustomNameVisible", (char)a_Monster->IsCustomNameAlwaysVisible());
switch (a_Monster->GetMobType())
{
case cMonster::mtBat:
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index fe309ce4e..10cc39083 100644
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -2652,6 +2652,19 @@ bool cWSSAnvil::LoadMonsterBaseFromNBT(cMonster & a_Monster, const cParsedNBT &
a_Monster.SetCanPickUpLoot(CanPickUpLoot);
}
+ int CustomNameTag = a_NBT.FindChildByName(a_TagIdx, "CustomName");
+ if ((CustomNameTag > 0) && (a_NBT.GetType(CustomNameTag) == TAG_String))
+ {
+ a_Monster.SetCustomName(a_NBT.GetString(CustomNameTag));
+ }
+
+ int CustomNameVisibleTag = a_NBT.FindChildByName(a_TagIdx, "CustomNameVisible");
+ if ((CustomNameVisibleTag > 0) && (a_NBT.GetType(CustomNameVisibleTag) == TAG_Byte))
+ {
+ bool CustomNameVisible = (a_NBT.GetByte(CustomNameVisibleTag) == 1);
+ a_Monster.SetCustomNameAlwaysVisible(CustomNameVisible);
+ }
+
return true;
}