summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/NBTChunkSerializer.cpp
diff options
context:
space:
mode:
author12xx12 <44411062+12xx12@users.noreply.github.com>2020-11-23 00:41:13 +0100
committerGitHub <noreply@github.com>2020-11-23 00:41:13 +0100
commite35519ec8ab1b958408ab2a90b88dffc1bcc7fb2 (patch)
tree3ed498478eabe7aa01b54f85d8ec9c2bc821fe66 /src/WorldStorage/NBTChunkSerializer.cpp
parentAdd coloured glass pane recipes (#5032) (diff)
downloadcuberite-e35519ec8ab1b958408ab2a90b88dffc1bcc7fb2.tar
cuberite-e35519ec8ab1b958408ab2a90b88dffc1bcc7fb2.tar.gz
cuberite-e35519ec8ab1b958408ab2a90b88dffc1bcc7fb2.tar.bz2
cuberite-e35519ec8ab1b958408ab2a90b88dffc1bcc7fb2.tar.lz
cuberite-e35519ec8ab1b958408ab2a90b88dffc1bcc7fb2.tar.xz
cuberite-e35519ec8ab1b958408ab2a90b88dffc1bcc7fb2.tar.zst
cuberite-e35519ec8ab1b958408ab2a90b88dffc1bcc7fb2.zip
Diffstat (limited to 'src/WorldStorage/NBTChunkSerializer.cpp')
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp92
1 files changed, 46 insertions, 46 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index d159f6e49..0e3cdde76 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -5,6 +5,7 @@
#include "Globals.h"
#include "NBTChunkSerializer.h"
#include "EnchantmentSerializer.h"
+#include "NamespaceSerializer.h"
#include "../ChunkDataCallback.h"
#include "../ItemGrid.h"
#include "../StringCompression.h"
@@ -546,7 +547,7 @@ public:
{
mWriter.BeginCompound("");
AddBasicTileEntity(a_MobSpawner, "MobSpawner");
- mWriter.AddString("EntityId", cMonster::MobTypeToVanillaName(a_MobSpawner->GetEntity()));
+ mWriter.AddString("EntityId", NamespaceSerializer::From(a_MobSpawner->GetEntity()));
mWriter.AddShort("SpawnCount", a_MobSpawner->GetSpawnCount());
mWriter.AddShort("SpawnRange", a_MobSpawner->GetSpawnRange());
mWriter.AddShort("Delay", a_MobSpawner->GetSpawnDelay());
@@ -643,7 +644,7 @@ public:
- void AddBasicEntity(cEntity * a_Entity, const AString & a_ClassName)
+ void AddBasicEntity(cEntity * a_Entity, const std::string_view a_ClassName)
{
mWriter.AddString("id", a_ClassName);
mWriter.BeginList("Pos", TAG_Double);
@@ -762,51 +763,8 @@ public:
void AddMonsterEntity(cMonster * a_Monster)
{
- const char * EntityClass = nullptr;
- switch (a_Monster->GetMobType())
- {
- case mtBat: EntityClass = "Bat"; break;
- case mtBlaze: EntityClass = "Blaze"; break;
- case mtCaveSpider: EntityClass = "CaveSpider"; break;
- case mtChicken: EntityClass = "Chicken"; break;
- case mtCow: EntityClass = "Cow"; break;
- case mtCreeper: EntityClass = "Creeper"; break;
- case mtEnderDragon: EntityClass = "EnderDragon"; break;
- case mtEnderman: EntityClass = "Enderman"; break;
- case mtGhast: EntityClass = "Ghast"; break;
- case mtGiant: EntityClass = "Giant"; break;
- case mtGuardian: EntityClass = "Guardian"; break;
- case mtHorse: EntityClass = "Horse"; break;
- case mtIronGolem: EntityClass = "VillagerGolem"; break;
- case mtMagmaCube: EntityClass = "LavaSlime"; break;
- case mtMooshroom: EntityClass = "MushroomCow"; break;
- case mtOcelot: EntityClass = "Ozelot"; break;
- case mtPig: EntityClass = "Pig"; break;
- case mtRabbit: EntityClass = "Rabbit"; break;
- case mtSheep: EntityClass = "Sheep"; break;
- case mtSilverfish: EntityClass = "Silverfish"; break;
- case mtSkeleton: EntityClass = "Skeleton"; break;
- case mtSlime: EntityClass = "Slime"; break;
- case mtSnowGolem: EntityClass = "SnowMan"; break;
- case mtSpider: EntityClass = "Spider"; break;
- case mtSquid: EntityClass = "Squid"; break;
- case mtVillager: EntityClass = "Villager"; break;
- case mtWitch: EntityClass = "Witch"; break;
- case mtWither: EntityClass = "WitherBoss"; break;
- case mtWitherSkeleton: EntityClass = "WitherSkeleton"; break;
- case mtWolf: EntityClass = "Wolf"; break;
- case mtZombie: EntityClass = "Zombie"; break;
- case mtZombiePigman: EntityClass = "PigZombie"; break;
- case mtZombieVillager: EntityClass = "ZombieVillager"; break;
- default:
- {
- ASSERT(!"Unhandled monster type");
- return;
- }
- } // switch (payload)
-
mWriter.BeginCompound("");
- AddBasicEntity(a_Monster, EntityClass);
+ AddBasicEntity(a_Monster, NamespaceSerializer::From(a_Monster->GetMobType()));
mWriter.BeginList("DropChances", TAG_Float);
mWriter.AddFloat("", a_Monster->GetDropChanceWeapon());
mWriter.AddFloat("", a_Monster->GetDropChanceHelmet());
@@ -971,6 +929,7 @@ public:
mWriter.AddInt("Profession", ZombieVillager->GetProfession());
mWriter.AddInt("ConversionTime", ZombieVillager->ConversionTime());
mWriter.AddInt("Age", ZombieVillager->GetAge());
+ break;
}
case mtBlaze:
case mtCaveSpider:
@@ -993,6 +952,47 @@ public:
// Other mobs have no special tags.
break;
}
+ case mtCat:
+ case mtCod:
+ case mtDolphin:
+ case mtDonkey:
+ case mtDrowned:
+ case mtElderGuardian:
+ case mtEndermite:
+ case mtEvoker:
+ case mtFox:
+ case mtHoglin:
+ case mtHusk:
+ case mtIllusioner:
+ case mtLlama:
+ case mtMule:
+ case mtPanda:
+ case mtParrot:
+ case mtPhantom:
+ case mtPiglin:
+ case mtPiglinBrute:
+ case mtPillager:
+ case mtPolarBear:
+ case mtPufferfish:
+ case mtRavager:
+ case mtSalmon:
+ case mtShulker:
+ case mtSkeletonHorse:
+ case mtStray:
+ case mtStrider:
+ case mtTraderLlama:
+ case mtTropicalFish:
+ case mtTurtle:
+ case mtVex:
+ case mtVindicator:
+ case mtWanderingTrader:
+ case mtZoglin:
+ case mtZombieHorse:
+ {
+ // All the entities not added
+ LOGD("Saving unimplemented entity type: %d", NamespaceSerializer::From(a_Monster->GetMobType()));
+ break;
+ }
case mtInvalidType:
{
ASSERT(!"NBTChunkSerializer::SerializerCollector::AddMonsterEntity: Recieved mob of invalid type");