summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/NBTChunkSerializer.cpp
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2017-09-14 10:48:57 +0200
committerAlexander Harkness <me@bearbin.net>2017-09-14 10:48:57 +0200
commit307e7aaff5c454b703db4d536c40d5715d96032b (patch)
treee217d6a073e6b87aaeb6618a933676d3251b9355 /src/WorldStorage/NBTChunkSerializer.cpp
parentUpdated compile.sh script (#4009) (diff)
downloadcuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar
cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.gz
cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.bz2
cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.lz
cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.xz
cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.zst
cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.zip
Diffstat (limited to 'src/WorldStorage/NBTChunkSerializer.cpp')
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp64
1 files changed, 34 insertions, 30 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index 1e8543648..12f767abf 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -643,6 +643,35 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
m_Writer.AddInt("Size", reinterpret_cast<const cMagmaCube *>(a_Monster)->GetSize());
break;
}
+ case mtOcelot:
+ {
+ const auto *Ocelot = reinterpret_cast<const cOcelot *>(a_Monster);
+ if (!Ocelot->GetOwnerName().empty())
+ {
+ m_Writer.AddString("Owner", Ocelot->GetOwnerName());
+ }
+ if (!Ocelot->GetOwnerUUID().IsNil())
+ {
+ m_Writer.AddString("OwnerUUID", Ocelot->GetOwnerUUID().ToShortString());
+ }
+ m_Writer.AddByte("Sitting", Ocelot->IsSitting() ? 1 : 0);
+ m_Writer.AddInt("CatType", Ocelot->GetOcelotType());
+ m_Writer.AddInt("Age", Ocelot->GetAge());
+ break;
+ }
+ case mtPig:
+ {
+ m_Writer.AddInt("Age", reinterpret_cast<const cPig *>(a_Monster)->GetAge());
+ break;
+ }
+ case mtRabbit:
+ {
+ const cRabbit * Rabbit = reinterpret_cast<const cRabbit *>(a_Monster);
+ m_Writer.AddInt("RabbitType", static_cast<Int32>(Rabbit->GetRabbitType()));
+ m_Writer.AddInt("MoreCarrotTicks", Rabbit->GetMoreCarrotTicks());
+ m_Writer.AddInt("Age", Rabbit->GetAge());
+ break;
+ }
case mtSheep:
{
const cSheep *Sheep = reinterpret_cast<const cSheep *>(a_Monster);
@@ -703,36 +732,6 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
m_Writer.AddInt("Age", reinterpret_cast<const cZombiePigman *>(a_Monster)->GetAge());
break;
}
- case mtOcelot:
- {
- const auto *Ocelot = reinterpret_cast<const cOcelot *>(a_Monster);
- if (!Ocelot->GetOwnerName().empty())
- {
- m_Writer.AddString("Owner", Ocelot->GetOwnerName());
- }
- if (!Ocelot->GetOwnerUUID().IsNil())
- {
- m_Writer.AddString("OwnerUUID", Ocelot->GetOwnerUUID().ToShortString());
- }
- m_Writer.AddByte("Sitting", Ocelot->IsSitting() ? 1 : 0);
- m_Writer.AddInt ("CatType", Ocelot->GetOcelotType());
- m_Writer.AddInt ("Age", Ocelot->GetAge());
- break;
- }
- case mtPig:
- {
- m_Writer.AddInt("Age", reinterpret_cast<const cPig *>(a_Monster)->GetAge());
- break;
- }
- case mtRabbit:
- {
- const cRabbit * Rabbit = reinterpret_cast<const cRabbit *>(a_Monster);
- m_Writer.AddInt("RabbitType", static_cast<Int32>(Rabbit->GetRabbitType()));
- m_Writer.AddInt("MoreCarrotTicks", Rabbit->GetMoreCarrotTicks());
- m_Writer.AddInt("Age", Rabbit->GetAge());
- break;
- }
- case mtInvalidType:
case mtBlaze:
case mtCaveSpider:
case mtChicken:
@@ -752,6 +751,11 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
// Other mobs have no special tags.
break;
}
+ case mtInvalidType:
+ {
+ ASSERT(!"cNBTChunkSerializer::AddMonsterEntity: Recieved mob of invalid type");
+ break;
+ }
}
m_Writer.EndCompound();
}