diff options
author | Mattes D <github@xoft.cz> | 2014-10-30 12:50:55 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-10-30 12:50:55 +0100 |
commit | 93f33b7d4eda4c6010827dc2a6522c3da34619f8 (patch) | |
tree | 122df2ff1cd5bb1b24aaf903aec5fce19cf8207d /src/WorldStorage/WSSAnvil.cpp | |
parent | Grown biomes: made biomes smaller, made beaches smaller. (diff) | |
parent | Merge pull request #1576 from mc-server/QtBiomeVisualiserThreadedGen (diff) | |
download | cuberite-93f33b7d4eda4c6010827dc2a6522c3da34619f8.tar cuberite-93f33b7d4eda4c6010827dc2a6522c3da34619f8.tar.gz cuberite-93f33b7d4eda4c6010827dc2a6522c3da34619f8.tar.bz2 cuberite-93f33b7d4eda4c6010827dc2a6522c3da34619f8.tar.lz cuberite-93f33b7d4eda4c6010827dc2a6522c3da34619f8.tar.xz cuberite-93f33b7d4eda4c6010827dc2a6522c3da34619f8.tar.zst cuberite-93f33b7d4eda4c6010827dc2a6522c3da34619f8.zip |
Diffstat (limited to 'src/WorldStorage/WSSAnvil.cpp')
-rw-r--r-- | src/WorldStorage/WSSAnvil.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
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(); |