summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/NBTChunkSerializer.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-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();
}