diff options
author | 12xx12 <44411062+12xx12@users.noreply.github.com> | 2020-09-27 19:02:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-27 19:02:16 +0200 |
commit | 410d6c00453f2207ddb7a184590251b62b4769fa (patch) | |
tree | f204973b0481e4579f79077f2b5cd73dd94f6959 /src/WorldStorage | |
parent | Remove unused Temporary namespace (diff) | |
download | cuberite-410d6c00453f2207ddb7a184590251b62b4769fa.tar cuberite-410d6c00453f2207ddb7a184590251b62b4769fa.tar.gz cuberite-410d6c00453f2207ddb7a184590251b62b4769fa.tar.bz2 cuberite-410d6c00453f2207ddb7a184590251b62b4769fa.tar.lz cuberite-410d6c00453f2207ddb7a184590251b62b4769fa.tar.xz cuberite-410d6c00453f2207ddb7a184590251b62b4769fa.tar.zst cuberite-410d6c00453f2207ddb7a184590251b62b4769fa.zip |
Diffstat (limited to 'src/WorldStorage')
-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); } } |