summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-11-04 15:45:08 +0100
committerMattes D <github@xoft.cz>2014-11-04 15:45:08 +0100
commit6201b3602c2f82fd9de68404a9e742c9cf3c6554 (patch)
treee086038a40a07eba6be7a10a18f9cc95527fc729 /src/WorldStorage
parentMoved the chrono include into Globals. (diff)
parentWebAdmin: Fixed login template destination address. (diff)
downloadcuberite-6201b3602c2f82fd9de68404a9e742c9cf3c6554.tar
cuberite-6201b3602c2f82fd9de68404a9e742c9cf3c6554.tar.gz
cuberite-6201b3602c2f82fd9de68404a9e742c9cf3c6554.tar.bz2
cuberite-6201b3602c2f82fd9de68404a9e742c9cf3c6554.tar.lz
cuberite-6201b3602c2f82fd9de68404a9e742c9cf3c6554.tar.xz
cuberite-6201b3602c2f82fd9de68404a9e742c9cf3c6554.tar.zst
cuberite-6201b3602c2f82fd9de68404a9e742c9cf3c6554.zip
Diffstat (limited to 'src/WorldStorage')
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp22
-rw-r--r--src/WorldStorage/WSSAnvil.cpp21
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();