summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage
diff options
context:
space:
mode:
authorPersson-dev <66266021+Persson-dev@users.noreply.github.com>2021-12-29 20:28:41 +0100
committerGitHub <noreply@github.com>2021-12-29 20:28:41 +0100
commitfec64bb91c03c5e872a8f6fbc1a253f341373072 (patch)
tree74eca1320f61b93cae672a0d9def7abea2ab80ef /src/WorldStorage
parentUpdate solid and transparent blocks (#5353) (diff)
downloadcuberite-fec64bb91c03c5e872a8f6fbc1a253f341373072.tar
cuberite-fec64bb91c03c5e872a8f6fbc1a253f341373072.tar.gz
cuberite-fec64bb91c03c5e872a8f6fbc1a253f341373072.tar.bz2
cuberite-fec64bb91c03c5e872a8f6fbc1a253f341373072.tar.lz
cuberite-fec64bb91c03c5e872a8f6fbc1a253f341373072.tar.xz
cuberite-fec64bb91c03c5e872a8f6fbc1a253f341373072.tar.zst
cuberite-fec64bb91c03c5e872a8f6fbc1a253f341373072.zip
Diffstat (limited to '')
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp3
-rw-r--r--src/WorldStorage/WSSAnvil.cpp52
2 files changed, 32 insertions, 23 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index e96acccef..dde6c299c 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -893,6 +893,9 @@ public:
const cVillager *Villager = static_cast<const cVillager *>(a_Monster);
mWriter.AddInt("Profession", Villager->GetVilType());
mWriter.AddInt("Age", Villager->GetAge());
+ mWriter.BeginList("Inventory", TAG_Compound);
+ AddItemGrid(Villager->GetInventory());
+ mWriter.EndList();
break;
}
case mtWither:
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index dbbd03daf..dfefb74d3 100644
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -1663,29 +1663,29 @@ void cWSSAnvil::LoadEntityFromNBT(cEntityList & a_Entities, const cParsedNBT & a
case mtHoglin: return LoadHoglinFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
case mtHusk: return LoadHuskFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
case mtIllusioner: return LoadIllusionerFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtIronGolem: return LoadVillagerFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtLlama: return LoadIronGolemFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtMagmaCube: return LoadLlamaFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtMooshroom: return LoadMagmaCubeFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtMule: return LoadMooshroomFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtOcelot: return LoadMuleFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtPanda: return LoadOcelotFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtParrot: return LoadPandaFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtPhantom: return LoadParrotFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtPig: return LoadPhantomFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtPiglin: return LoadPigFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtPiglinBrute: return LoadPiglinFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtPillager: return LoadPiglinBruteFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtPolarBear: return LoadPillagerFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtPufferfish: return LoadPolarBearFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtRabbit: return LoadPufferfishFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtRavager: return LoadRabbitFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtSalmon: return LoadRavagerFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtSheep: return LoadSalmonFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtShulker: return LoadSheepFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtSilverfish: return LoadShulkerFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtSkeleton: return LoadSilverfishFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
- case mtSkeletonHorse: return LoadSkeletonFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtIronGolem: return LoadIronGolemFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtLlama: return LoadLlamaFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtMagmaCube: return LoadMagmaCubeFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtMooshroom: return LoadMooshroomFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtMule: return LoadMuleFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtOcelot: return LoadOcelotFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtPanda: return LoadPandaFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtParrot: return LoadParrotFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtPhantom: return LoadPhantomFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtPig: return LoadPigFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtPiglin: return LoadPiglinFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtPiglinBrute: return LoadPiglinBruteFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtPillager: return LoadPillagerFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtPolarBear: return LoadPolarBearFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtPufferfish: return LoadPufferfishFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtRabbit: return LoadRabbitFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtRavager: return LoadRavagerFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtSalmon: return LoadSalmonFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtSheep: return LoadSheepFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtShulker: return LoadShulkerFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtSilverfish: return LoadSilverfishFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtSkeleton: return LoadSkeletonFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ case mtSkeletonHorse: return LoadSkeletonHorseFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
case mtSlime: return LoadSlimeFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
case mtSnowGolem: return LoadSnowGolemFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
case mtSpider: return LoadSpiderFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
@@ -3270,6 +3270,12 @@ void cWSSAnvil::LoadVillagerFromNBT(cEntityList & a_Entities, const cParsedNBT &
Monster->SetAge(Age);
}
+ int InventoryIdx = a_NBT.FindChildByName(a_TagIdx, "Inventory");
+ if (InventoryIdx > 0)
+ {
+ LoadItemGridFromNBT(Monster->GetInventory(), a_NBT, InventoryIdx);
+ }
+
a_Entities.emplace_back(std::move(Monster));
}