summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage
diff options
context:
space:
mode:
Diffstat (limited to 'src/WorldStorage')
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp5
-rwxr-xr-xsrc/WorldStorage/WSSAnvil.cpp8
2 files changed, 9 insertions, 4 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index 1e8543648..5011075f1 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -664,8 +664,9 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
case mtVillager:
{
const cVillager *Villager = reinterpret_cast<const cVillager *>(a_Monster);
- m_Writer.AddInt("Profession", Villager->GetVilType());
- m_Writer.AddInt("Age", Villager->GetAge());
+ m_Writer.AddInt("Profession", static_cast<Int32>(cVillager::VillagerCareerToProfession(Villager->GetCareer())));
+ m_Writer.AddInt("Career", static_cast<Int32>(Villager->GetCareer()));
+ m_Writer.AddInt("Age", Villager->GetAge());
break;
}
case mtWither:
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index a3251481f..774699b8f 100755
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -2837,9 +2837,13 @@ void cWSSAnvil::LoadVillagerFromNBT(cEntityList & a_Entities, const cParsedNBT &
return;
}
- int Type = a_NBT.GetInt(TypeIdx);
+ int CareerIdx = a_NBT.FindChildByName(a_TagIdx, "Career");
+ if (CareerIdx < 0)
+ {
+ return;
+ }
- std::unique_ptr<cVillager> Monster = cpp14::make_unique<cVillager>(cVillager::eVillagerType(Type));
+ std::unique_ptr<cVillager> Monster = cpp14::make_unique<cVillager>(cVillager::VillagerCareer(a_NBT.GetInt(TypeIdx)), 1U);
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;