diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-11-23 18:12:34 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-11-23 18:12:34 +0100 |
commit | 79e5b823547a2a51d9f4e504fc24ec539e11ac34 (patch) | |
tree | 672b77f1c9a4741437b30f3289fc258d7917a2eb /src/WorldStorage | |
parent | Compilation fixes (diff) | |
parent | Merge pull request #1612 from p-mcgowan/pigsIntoZombiePigmenOnLightning (diff) | |
download | cuberite-79e5b823547a2a51d9f4e504fc24ec539e11ac34.tar cuberite-79e5b823547a2a51d9f4e504fc24ec539e11ac34.tar.gz cuberite-79e5b823547a2a51d9f4e504fc24ec539e11ac34.tar.bz2 cuberite-79e5b823547a2a51d9f4e504fc24ec539e11ac34.tar.lz cuberite-79e5b823547a2a51d9f4e504fc24ec539e11ac34.tar.xz cuberite-79e5b823547a2a51d9f4e504fc24ec539e11ac34.tar.zst cuberite-79e5b823547a2a51d9f4e504fc24ec539e11ac34.zip |
Diffstat (limited to 'src/WorldStorage')
-rw-r--r-- | src/WorldStorage/NBTChunkSerializer.cpp | 22 | ||||
-rw-r--r-- | src/WorldStorage/WSSAnvil.cpp | 21 |
2 files changed, 41 insertions, 2 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp index d85a5c329..4daa8cc7b 100644 --- a/src/WorldStorage/NBTChunkSerializer.cpp +++ b/src/WorldStorage/NBTChunkSerializer.cpp @@ -604,6 +604,28 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster) m_Writer.AddByte("IsConverting", (((const cZombie *)a_Monster)->IsConverting() ? 1 : 0)); break; } + case mtInvalidType: + case mtBlaze: + case mtCaveSpider: + case mtChicken: + case mtCow: + case mtEnderDragon: + case mtGhast: + case mtGiant: + case mtIronGolem: + case mtMooshroom: + case mtOcelot: + case mtPig: + case mtSilverfish: + case mtSnowGolem: + case mtSpider: + case mtSquid: + case mtWitch: + case mtZombiePigman: + { + // Other mobs have no special tags. + break; + } } m_Writer.EndCompound(); } diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index af7551ee4..0c77b4d67 100644 --- a/src/WorldStorage/WSSAnvil.cpp +++ b/src/WorldStorage/WSSAnvil.cpp @@ -696,11 +696,28 @@ cBlockEntity * cWSSAnvil::LoadBlockEntityFromNBT(const cParsedNBT & a_NBT, int a bool cWSSAnvil::LoadItemFromNBT(cItem & a_Item, const cParsedNBT & a_NBT, int a_TagIdx) { int Type = a_NBT.FindChildByName(a_TagIdx, "id"); - if ((Type < 0) || (a_NBT.GetType(Type) != TAG_Short)) + if (Type <= 0) { return false; } - a_Item.m_ItemType = a_NBT.GetShort(Type); + + if (a_NBT.GetType(Type) == TAG_String) + { + if (!StringToItem(a_NBT.GetString(Type), a_Item)) + { + // Can't resolve item type + return false; + } + } + else if (a_NBT.GetType(Type) == TAG_Short) + { + a_Item.m_ItemType = a_NBT.GetShort(Type); + } + else + { + return false; + } + if (a_Item.m_ItemType < 0) { a_Item.Empty(); |