diff options
Diffstat (limited to '')
-rw-r--r-- | src/WorldStorage/NBTChunkSerializer.cpp | 1 | ||||
-rwxr-xr-x | src/WorldStorage/WSSAnvil.cpp | 25 |
2 files changed, 6 insertions, 20 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp index c78b04c66..70f07557f 100644 --- a/src/WorldStorage/NBTChunkSerializer.cpp +++ b/src/WorldStorage/NBTChunkSerializer.cpp @@ -546,7 +546,6 @@ public: { mWriter.BeginCompound(""); AddBasicTileEntity(a_MobSpawner, "MobSpawner"); - mWriter.AddShort("Entity", static_cast<short>(a_MobSpawner->GetEntity())); mWriter.AddString("EntityId", cMonster::MobTypeToVanillaName(a_MobSpawner->GetEntity())); mWriter.AddShort("Delay", a_MobSpawner->GetSpawnDelay()); mWriter.EndCompound(); diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index b01bb7fd5..03decbea3 100755 --- a/src/WorldStorage/WSSAnvil.cpp +++ b/src/WorldStorage/WSSAnvil.cpp @@ -1338,27 +1338,14 @@ OwnedBlockEntity cWSSAnvil::LoadMobSpawnerFromNBT(const cParsedNBT & a_NBT, int auto MobSpawner = std::make_unique<cMobSpawnerEntity>(a_BlockType, a_BlockMeta, a_Pos, m_World); - // Load entity (Cuberite worlds): - int Type = a_NBT.FindChildByName(a_TagIdx, "Entity"); - if ((Type >= 0) && (a_NBT.GetType(Type) == TAG_Short)) + // Load entity type + int Type = a_NBT.FindChildByName(a_TagIdx, "EntityId"); + if ((Type >= 0) && (a_NBT.GetType(Type) == TAG_String)) { - short MonsterType = a_NBT.GetShort(Type); - if ((MonsterType >= 50) && (MonsterType <= 120)) + eMonsterType MonsterType = cMonster::StringToMobType(a_NBT.GetString(Type)); + if (MonsterType != eMonsterType::mtInvalidType) { - MobSpawner->SetEntity(static_cast<eMonsterType>(MonsterType)); - } - } - else - { - // Load entity (vanilla worlds): - Type = a_NBT.FindChildByName(a_TagIdx, "EntityId"); - if ((Type >= 0) && (a_NBT.GetType(Type) == TAG_String)) - { - eMonsterType MonsterType = cMonster::StringToMobType(a_NBT.GetString(Type)); - if (MonsterType != eMonsterType::mtInvalidType) - { - MobSpawner->SetEntity(MonsterType); - } + MobSpawner->SetEntity(MonsterType); } } |